Skip to content

Commit

Permalink
update renderrer
Browse files Browse the repository at this point in the history
  • Loading branch information
zonblade committed Mar 4, 2024
1 parent c357f72 commit 9eac0e8
Show file tree
Hide file tree
Showing 10 changed files with 1,467 additions and 27 deletions.
1,211 changes: 1,211 additions & 0 deletions docs/assets/highlight.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/assets/markdown.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions docs/assets/prism.css

This file was deleted.

10 changes: 0 additions & 10 deletions docs/assets/prism.js

This file was deleted.

25 changes: 25 additions & 0 deletions docs/assets/render.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/es/highlight.min.js';
// import ts from 'https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/es/languages/typescript.min.js';
// hljs.registerLanguage('ts', ts);

async function CST_MenuConstructor() {
// open menu.yml from uri
var menu = "menu.json";
var url = menu;
const res = await fetch(url).then(res => res.json())
console.log(res)
}

async function CST_ContentConstructor() {
const res = await fetch("pages/intro.md").then(res => res.text()).catch(err => console.error(err))
console.log(res)
const md = window.markdownit();
const result = md.render(res);
document.getElementById('root').innerHTML = result;
hljs.highlightAll()
}

(async () => {
await CST_MenuConstructor()
await CST_ContentConstructor()
})()
38 changes: 38 additions & 0 deletions docs/assets/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
* {
color: white;
}

/* make table border white 0.5 */
table {
border-collapse: collapse;
width: 100%;
}

th,
td {
border: 0.5px solid rgb(156, 156, 156);
padding: 8px;
text-align: left;
}

th {
background-color: #1b1b1b;
}

tr:nth-child(even) {
background-color: #1b1b1b;
}

tr:nth-child(odd) {
background-color: #1b1b1b;
}

tr:hover {
background-color: #404040;
}

p code {
background-color: #484848;
border-radius: 4px;
padding: 3px 5px;
}
143 changes: 143 additions & 0 deletions docs/assets/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
pre code.hljs {
display: block;
overflow-x: auto;
padding: 1em;
border-radius: 5px;
}

code.hljs {
padding: 3px 5px
}

/*!
Theme: GitHub Dark Dimmed
Description: Dark dimmed theme as seen on github.com
Author: github.com
Maintainer: @Hirse
Updated: 2021-05-15
Colors taken from GitHub's CSS
*/
.hljs {
color: #adbac7;
background: #22272e
}

.hljs-doctag,
.hljs-keyword,
.hljs-meta .hljs-keyword,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type,
.hljs-variable.language_ {
/* prettylights-syntax-keyword */
color: #f47067
}

.hljs-title,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-title.function_ {
/* prettylights-syntax-entity */
color: #dcbdfb
}

.hljs-attr,
.hljs-attribute,
.hljs-literal,
.hljs-meta,
.hljs-number,
.hljs-operator,
.hljs-variable,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-id {
/* prettylights-syntax-constant */
color: #6cb6ff
}

.hljs-regexp,
.hljs-string,
.hljs-meta .hljs-string {
/* prettylights-syntax-string */
color: #96d0ff
}

.hljs-built_in,
.hljs-symbol {
/* prettylights-syntax-variable */
color: #f69d50
}

.hljs-comment,
.hljs-code,
.hljs-formula {
/* prettylights-syntax-comment */
color: #768390
}

.hljs-name,
.hljs-quote,
.hljs-selector-tag,
.hljs-selector-pseudo {
/* prettylights-syntax-entity-tag */
color: #8ddb8c
}

.hljs-subst {
/* prettylights-syntax-storage-modifier-import */
color: #adbac7
}

.hljs-section {
/* prettylights-syntax-markup-heading */
color: #316dca;
font-weight: bold
}

.hljs-bullet {
/* prettylights-syntax-markup-list */
color: #eac55f
}

.hljs-emphasis {
/* prettylights-syntax-markup-italic */
color: #adbac7;
font-style: italic
}

.hljs-strong {
/* prettylights-syntax-markup-bold */
color: #adbac7;
font-weight: bold
}

.hljs-addition {
/* prettylights-syntax-markup-inserted */
color: #b4f1b4;
background-color: #1b4721
}

.hljs-deletion {
/* prettylights-syntax-markup-deleted */
color: #ffd8d3;
background-color: #78191b
}

.hljs-char.escape_,
.hljs-link,
.hljs-params,
.hljs-property,
.hljs-punctuation,
.hljs-tag {
/* purposely ignored */

}

.language-xml .hljs-tag {
color: #e8e8e8;
}

.language-xml .hljs-tag .hljs-name {
color: #00cc22;
}
26 changes: 13 additions & 13 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="assets/prism.css">
<script src="assets/prism.js"></script>
</head>
<body>
<pre><code class="language-ts">
export async ACT_Test(){
return(
<div></div>
)
}</code></pre>
</body>
</html>

<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css">
<link rel="stylesheet" href="assets/theme.css">
<link rel="stylesheet" href="assets/style.css">
<script src="assets/markdown.js"></script>
<script type="module" src="assets/render.mjs"></script>
</head>

<body id="root" style="background-color: #1b1b1b;">
</body>

</html>
12 changes: 12 additions & 0 deletions docs/menu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"main": "menu-home",
"menu": [
{
"id": "menu-home",
"mode":"menu",
"title": "Home",
"file": "",
"menu": []
}
]
}
22 changes: 22 additions & 0 deletions docs/pages/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

## test ini judul

```html
<h1>hello<span></span></h1>
```

| Name | Age |
|------|-----|
| John | 20 |

```tsx
const hello = () => {
const ok = "yaaa";

return (
<h1>hello<span></span></h1>
)
}
```

hello `test`

0 comments on commit 9eac0e8

Please sign in to comment.