aboutsummaryrefslogtreecommitdiffstats
path: root/spring-front/src/index.js
blob: 2b3e29dbd3f67f7cee17445716c86e5d69a64f32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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";
import "./index.css";

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"));