-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6269148
commit 4a1d3ce
Showing
3 changed files
with
17 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
@import url('https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/atom-one-dark.min.css'); | ||
@import url('https://cdn.jsdelivr.net/npm/highlight.js@11.8.0/styles/atom-one-dark.min.css'); | ||
html { | ||
color: #98a3ad; | ||
background-color: #131516; | ||
max-width: 900px; | ||
font-family: system-ui, sans-serif; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import hljs from 'https://cdn.jsdelivr.net/npm/highlightjs@9.16.2/+esm' | ||
import hljs from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/es/highlight.min.js'; | ||
import javascript from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/es/languages/javascript.min.js'; | ||
import yaml from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/es/languages/yaml.min.js'; | ||
import css from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/es/languages/css.min.js'; | ||
import json from 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/es/languages/json.min.js'; | ||
hljs.registerLanguage('javascript', javascript); | ||
hljs.registerLanguage('yaml', yaml); | ||
hljs.registerLanguage('css', css); | ||
hljs.registerLanguage('json', json); | ||
|
||
const inscription = document.documentElement.dataset.inscription; | ||
const response = await fetch(`/content/${inscription}`); | ||
const contentType = response.headers.get("content-type"); | ||
const language = contentType.split("/")[1]; | ||
const code = await response.text(); | ||
const codeBlock = document.createElement('code'); | ||
codeBlock.innerHTML = hljs.highlightAuto(code).value; | ||
document.body.appendChild(codeBlock); | ||
document.body.innerHTML = `<pre><code>${hljs.highlight(code, {language, ignoreIllegals: true}).value}</code></pre>`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
<!doctype html> | ||
<html lang=en data-inscription={{self.inscription_id}}> <head> | ||
<html lang=en data-inscription={{self.inscription_id}}> | ||
<head> | ||
<meta charset=utf-8> | ||
<link rel=stylesheet href=/static/preview-code.css> | ||
<script src=/static/preview-code.js defer type=module></script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> | ||
</html> |