aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2022-03-21 21:57:51 +0000
committerterminaldweller <thabogre@gmail.com>2022-03-21 21:57:51 +0000
commitb9047281771af59bc9dc5c6380321c3cfc81f1c0 (patch)
treee21c3e54541b12db4a100e765fd7bcaa11856250
parentwip (diff)
downloadmdrtl-b9047281771af59bc9dc5c6380321c3cfc81f1c0.tar.gz
mdrtl-b9047281771af59bc9dc5c6380321c3cfc81f1c0.zip
wip
-rw-r--r--spring-front/public/index.css37
-rw-r--r--spring-front/public/index.html29
-rw-r--r--spring-front/public/index.js16
-rw-r--r--src/main/java/com/terminaldweller/doc/Md.java21
4 files changed, 103 insertions, 0 deletions
diff --git a/spring-front/public/index.css b/spring-front/public/index.css
new file mode 100644
index 0000000..c23fdc6
--- /dev/null
+++ b/spring-front/public/index.css
@@ -0,0 +1,37 @@
+body {
+ color: #005f87;
+ background: #000000;
+ font-family: "DejaVuSansMono NF", Helvetica, monospace;
+}
+
+.article{$
+ text-align: left;
+ padding: 2%;
+ border-style: solid;
+ position: relative;
+ white-space: -moz-pre-wrap !important;
+ color: #005f87;
+ background: #000000;
+ font-family: "DejaVuSansMono NF", Helvetica, monospace;
+ overflow-wrap: break-word;
+ float: left;
+ /* width: 78%; */
+ width: 95%;
+}
+
+a {
+ color: #005f87;
+ text-decoration: none;
+}
+
+hr {
+ color: #005f87;
+}
+
+.left-footer {
+ float: left;
+}
+
+.right-footer {
+ float: right;
+}
diff --git a/spring-front/public/index.html b/spring-front/public/index.html
new file mode 100644
index 0000000..c74140d
--- /dev/null
+++ b/spring-front/public/index.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <script
+ crossorigin
+ src="https://unpkg.com/react@17/umd/react.production.min.js"
+ ></script>
+ <script
+ crossorigin
+ src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"
+ ></script>
+ <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
+ <link
+ rel="stylesheet"
+ href="/index.css"
+ type="text/css"
+ media="screen"
+ title="no title"
+ charset="utf-8"
+ />
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width" />
+ <title>RTLMD</title>
+ </head>
+ <body>
+ <script src="index.js" defer></script>
+ <div id="root"></div>
+ </body>
+</html>
diff --git a/spring-front/public/index.js b/spring-front/public/index.js
new file mode 100644
index 0000000..e6b507f
--- /dev/null
+++ b/spring-front/public/index.js
@@ -0,0 +1,16 @@
+import React from "react";
+import ReactDOM from "react-dom";
+
+const page = (
+ <div>
+ <h1>my awesome website in react</h1>
+ <h3>REasons</h3>
+ <ol>
+ <li>one</li>
+ <li>two</li>
+ <li>three</li>
+ <li>four</li>
+ </ol>
+ </div>
+);
+ReactDOM.render(page, document.getElementById("root"));
diff --git a/src/main/java/com/terminaldweller/doc/Md.java b/src/main/java/com/terminaldweller/doc/Md.java
new file mode 100644
index 0000000..be0c447
--- /dev/null
+++ b/src/main/java/com/terminaldweller/doc/Md.java
@@ -0,0 +1,21 @@
+package com.terminaldweller.doc;
+
+import org.commonmark.node.Node;
+import org.commonmark.parser.Parser;
+import org.commonmark.renderer.html.HtmlRenderer;
+
+/** The markdown class which provides the markdown parser. */
+public class Md {
+ /**
+ * Parses a markdown string and returns the result in html.
+ *
+ * @param markdown the string containing the markdown string.
+ * @return the rendered markdown document in html.
+ */
+ public String mdparseService(String markdown) {
+ Parser parser = parser.builder().build();
+ Node document = parser.parse(markdown);
+ HtmlRenderer renderer = HtmlRenderer.builder().build();
+ return renderer.render(document);
+ }
+}