[0.1.2] formatting update

multi-line codeblocks should no longer horribly break at the cost of not allowing tabs in them
This commit is contained in:
yellows111 2024-10-10 20:25:34 +01:00
parent f51418b79d
commit 4e65d573b2
Signed by: yellows111
SSH Key Fingerprint: SHA256:ynw5IJBU1pb7fZfHgLihKu9gHHA8FVpixZbB6IEB3r8
3 changed files with 14 additions and 4 deletions

View File

@ -39,7 +39,7 @@ if(Process.argv.length < 4 && require.main === module) {
function markup(input, options) { function markup(input, options) {
let tableOfContents = new Remarkable().use(TOCGenerator.plugin(options)).render(input); let tableOfContents = new Remarkable().use(TOCGenerator.plugin(options)).render(input);
let output = new Remarkable().use(RemarkableHeaderIDs()).render("# Table of contents:\n"+tableOfContents.content+"\n"+input); let output = new Remarkable().use(RemarkableHeaderIDs()).render("# Table of contents:\n"+tableOfContents.content+"\n\n"+input);
return output; return output;
} }
@ -73,6 +73,16 @@ function format(data, name) {
.replace( /* fix tag attached to word and not whitespace */ .replace( /* fix tag attached to word and not whitespace */
/(\w+)(<[a-zA-Z]\w*>)/g, /(\w+)(<[a-zA-Z]\w*>)/g,
"$1 $2" "$1 $2"
)
.replace( /* replace .md links to html ones */
/href="(.+)\.md"/g,
"href=\"$1.html\""
)
.replace( /* evil codeblock fix */
/<pre><code>((.|\n)*?)<\/code><\/pre>/g,
function(match, inline) {
return "<pre><code>" + inline.replace(/\t/g, "") + "</code></pre>";
}
); );
} }
// probably should bring in a better templating engine but whatever // probably should bring in a better templating engine but whatever

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "yiki", "name": "yiki",
"version": "0.1.1", "version": "0.1.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "yiki", "name": "yiki",
"version": "0.1.1", "version": "0.1.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@liquify/prettify": "^0.5.5-beta.1", "@liquify/prettify": "^0.5.5-beta.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "yiki", "name": "yiki",
"version": "0.1.1", "version": "0.1.2",
"description": "The yellows111 wiki system", "description": "The yellows111 wiki system",
"main": "compile.js", "main": "compile.js",
"scripts": { "scripts": {