aboutsummaryrefslogtreecommitdiffstats
path: root/spring-front/src/index.js
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2022-03-23 04:03:15 +0000
committerterminaldweller <thabogre@gmail.com>2022-03-23 04:03:15 +0000
commit63ad960e4a8f51486dd25eb61c9c5b0f74cacd81 (patch)
treee5127bede8e3bc7aea3811db0ee30797baf3dfbe /spring-front/src/index.js
parentwip (diff)
downloadmdrtl-63ad960e4a8f51486dd25eb61c9c5b0f74cacd81.tar.gz
mdrtl-63ad960e4a8f51486dd25eb61c9c5b0f74cacd81.zip
wip
Diffstat (limited to 'spring-front/src/index.js')
-rw-r--r--spring-front/src/index.js47
1 files changed, 34 insertions, 13 deletions
diff --git a/spring-front/src/index.js b/spring-front/src/index.js
index e6b507f..1b3e051 100644
--- a/spring-front/src/index.js
+++ b/spring-front/src/index.js
@@ -1,16 +1,37 @@
import React from "react";
import ReactDOM from "react-dom";
+import hljs from "highlight.js/lib/core";
+import markdown from "highlight.js/lib/languages/markdown";
+import "highlight.js/styles/devibeans.css";
-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"));
+hljs.registerLanguage("markdown", markdown);
+
+function update(text) {
+ let result_element = document.querySelector("#highlight-content");
+ result_element.innerText = text;
+ return hljs.highlight(text, { language: "markdown" }).value;
+}
+
+function CreateTextArea() {
+ return <textarea name="editor" className="editor" id="editor"></textarea>;
+}
+
+function CreatePreCode() {
+ return (
+ <pre id="highlight" aria-hidden="true">
+ <code className="language-markdown" id="highlight-content"></code>
+ </pre>
+ );
+}
+
+function CreateRoot() {
+ return (
+ <div>
+ <p>RTLMD ftw bebe!!!</p>
+ </div>
+ );
+}
+
+ReactDOM.render(<CreatePreCode />, document.getElementById("root2"));
+ReactDOM.render(<CreateTextArea />, document.getElementById("root2"));
+ReactDOM.render(<CreateRoot />, document.getElementById("root"));