Skip to content

Commit a9d8771

Browse files
authored
Merge pull request #1840 from progfay/github-pages
add `/docs`
2 parents 4a96385 + c532264 commit a9d8771

File tree

3 files changed

+117
-7
lines changed

3 files changed

+117
-7
lines changed

docs/index.html

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>scrapbox-parser</title>
9+
<style>
10+
* {
11+
margin: 0;
12+
}
13+
14+
html,
15+
body {
16+
width: 100vw;
17+
height: 100vh;
18+
overscroll-behavior: none;
19+
}
20+
21+
#container {
22+
overscroll-behavior: none;
23+
width: 100%;
24+
height: 100%;
25+
display: flex;
26+
flex-direction: row;
27+
}
28+
29+
#left-pane,
30+
#right-pane {
31+
width: 50vw;
32+
height: 100vh;
33+
}
34+
35+
#left-pane {
36+
background-color: #dcdde0;
37+
}
38+
39+
#navbar {
40+
width: 100%;
41+
height: 54px;
42+
margin-bottom: 36px;
43+
background-color: #353b48;
44+
}
45+
46+
#plain-text {
47+
width: calc(50vw - 72px);
48+
height: calc(100% - 144px);
49+
padding: 36px;
50+
border: none;
51+
border-radius: 4px;
52+
box-shadow: 0 4px 0 rgba(0, 0, 0, 0.16);
53+
margin: 0 36px;
54+
box-sizing: border-box;
55+
outline: none;
56+
}
57+
58+
#parsed-json {
59+
width: 100%;
60+
height: 100%;
61+
background-color: #282936;
62+
color: #FAFAFA;
63+
border: none;
64+
outline: none;
65+
font-size: 1rem;
66+
padding: 36px;
67+
box-sizing: border-box;
68+
overflow: auto;
69+
}
70+
71+
#parse-button {
72+
width: 50px;
73+
height: 50px;
74+
border-radius: 50%;
75+
position: absolute;
76+
top: calc(50vh - 25px);
77+
left: calc(50vw - 25px);
78+
background-color: #39ac86;
79+
border: none;
80+
font-size: 2rem;
81+
color: white;
82+
outline: none;
83+
}
84+
</style>
85+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/base16/dracula.min.css">
86+
</head>
87+
88+
<body>
89+
<article id="container">
90+
<section id="left-pane">
91+
<nav id="navbar"></nav>
92+
<textarea id="plain-text"></textarea>
93+
</section>
94+
<section id="right-pane">
95+
<pre id="parsed-json"><code class="json hljs"></code></pre>
96+
</section>
97+
</article>
98+
<button type="button" id="parse-button"></button>
99+
<script type="module" src="./script.js"></script>
100+
</body>
101+
102+
</html>

docs/script.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import hljs from "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/es/highlight.min.js";
2+
import { parse } from "https://unpkg.com/@progfay/scrapbox-parser";
3+
4+
document.getElementById("parse-button").addEventListener("click", () => {
5+
const parsedJson = JSON.stringify(
6+
parse(document.getElementById("plain-text").value),
7+
null,
8+
2,
9+
).trim();
10+
const a = hljs.highlight(parsedJson, { language: "json" }).value;
11+
console.log(a);
12+
document.querySelector("#parsed-json>.json").innerHTML = a;
13+
});

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"version": "10.0.0",
44
"type": "module",
55
"description": "parse Scrapbox notation to JavaScript Object",
6-
"files": [
7-
"dist"
8-
],
6+
"files": ["dist"],
97
"types": "./dist/index.d.ts",
108
"exports": {
119
".": "./dist/index.js",
@@ -33,10 +31,7 @@
3331
"type": "git",
3432
"url": "git+https://github.com/progfay/scrapbox-parser.git"
3533
},
36-
"keywords": [
37-
"scrapbox",
38-
"parser"
39-
],
34+
"keywords": ["scrapbox", "parser"],
4035
"author": "progfay",
4136
"license": "MIT",
4237
"bugs": {

0 commit comments

Comments
 (0)