1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-06-02 22:23:01 +00:00

Add output_classes property to external renderer, and new .invert-when-dark class in theme

ABC Notation & Server-Side Latex look good naow! :D
This commit is contained in:
Starbeamrainbowlabs 2019-10-25 12:12:57 +01:00
parent 6d683533f5
commit f044d25f7e
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 40 additions and 34 deletions

View file

@ -337,7 +337,7 @@
"version": "0.10", "version": "0.10",
"author": "Emanuil Rusev & Starbeamrainbowlabs", "author": "Emanuil Rusev & Starbeamrainbowlabs",
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation.", "description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation.",
"lastupdate": 1571958901, "lastupdate": 1572001815,
"optional": false, "optional": false,
"extra_data": { "extra_data": {
"Parsedown.php": "https:\/\/raw.githubusercontent.com\/erusev\/parsedown\/fe7a50eceb4a3c867cc9fa9c0aa906b1067d1955\/Parsedown.php", "Parsedown.php": "https:\/\/raw.githubusercontent.com\/erusev\/parsedown\/fe7a50eceb4a3c867cc9fa9c0aa906b1067d1955\/Parsedown.php",

View file

@ -1012,10 +1012,12 @@ class PeppermintParsedown extends ParsedownExtreme
"name" => "img", "name" => "img",
"attributes" => [ "attributes" => [
"alt" => "Diagram rendered by {$renderer->name}", "alt" => "Diagram rendered by {$renderer->name}",
"src" => "?action=parsedown-render-ext&language=$language&immutable_key=".hash("crc32b", json_encode($renderer))."&source=".rawurlencode($text) "src" => "?action=parsedown-render-ext&language=".rawurlencode($language)."&immutable_key=".hash("crc32b", json_encode($renderer))."&source=".rawurlencode($text)
] ]
] ]
]; ];
if(!empty($renderer->output_classes))
$result["element"]["element"]["attributes"]["class"] = implode(" ", $renderer->output_classes);
return $result; return $result;
} }

View file

@ -23,38 +23,40 @@
"parser_cache_min_size": { "type": "number", "description": "The minimum size a source string must be (in bytes) before it's considered eligible for caching.", "default": 1024 }, "parser_cache_min_size": { "type": "number", "description": "The minimum size a source string must be (in bytes) before it's considered eligible for caching.", "default": 1024 },
"parser_ext_renderers_enabled": { "type": "checkbox", "description": "Whether to enable external diagram renderer support, which is part of the parsedown parser. See the <code>parser_ext_renderers</code> setting below for more information.", "default": true }, "parser_ext_renderers_enabled": { "type": "checkbox", "description": "Whether to enable external diagram renderer support, which is part of the parsedown parser. See the <code>parser_ext_renderers</code> setting below for more information.", "default": true },
"parser_ext_renderers": { "type": "parserext", "description": "Used by the parsedown parser as an object mapping fenced code block languages to their respective external renderers. Should be in the form <code>language_code</code> → <code>external renderer definition</code>. See the default for examples on how to define an external renderer. Warning: On Windows, the enforcement of strict time limits is not possible. Beware of DoS attacks!", "default": { "parser_ext_renderers": { "type": "parserext", "description": "Used by the parsedown parser as an object mapping fenced code block languages to their respective external renderers. Should be in the form <code>language_code</code> → <code>external renderer definition</code>. See the default for examples on how to define an external renderer. Warning: On Windows, the enforcement of strict time limits is not possible. Beware of DoS attacks!", "default": {
"nomnoml": { "nomnoml": {
"name": "nomnoml", "name": "nomnoml",
"description": "The nomnoml UML diagram renderer. Requires the 'nomnoml' npm package to be globally installed.", "description": "The nomnoml UML diagram renderer. Requires the 'nomnoml' npm package to be globally installed.",
"url": "http://nomnoml.com/", "url": "http:\/\/nomnoml.com\/",
"cli": "nomnoml {input_file} {output_file} 0", "cli": "nomnoml {input_file} {output_file} 0",
"cli_mode": "file", "cli_mode": "file",
"output_format": "image/svg+xml" "output_format": "image\/svg+xml"
}, },
"plantuml": { "plantuml": {
"name": "PlantUML", "name": "PlantUML",
"description": "The PlantUML diagram renderer. Supports many different diagram types. Requires plantuml to be installed.", "description": "The PlantUML diagram renderer. Supports many different diagram types. Requires plantuml to be installed.",
"url": "http://plantuml.com/", "url": "http:\/\/plantuml.com\/",
"cli": "plantuml -tsvg -pipe", "cli": "plantuml -tsvg -pipe",
"cli_mode": "pipe", "cli_mode": "pipe",
"output_format": "image/svg+xml" "output_format": "image\/svg+xml"
}, },
"abc": { "abc": {
"name": "ABC Notation", "name": "ABC Notation",
"description": "A simple music notation typesetter. Much easier to understand than Lilypond. Requires abcm2ps to be installed.", "description": "A simple music notation typesetter. Much easier to understand than Lilypond. Requires abcm2ps to be installed.",
"url": "https://abcnotation.com/", "url": "https:\/\/abcnotation.com\/",
"cli": "abcm2ps -g -O - -", "cli": "abcm2ps -g -O - -",
"cli_mode": "pipe", "cli_mode": "pipe",
"output_format": "image/svg+xml" "output_format": "image\/svg+xml",
}, "output_classes": [ "invert-when-dark" ]
"latexserver": { },
"name": "Server-Side MathJax", "latexserver": {
"description": "Client-side Mathjax via the 'enable_math_rendering' setting not your thing? Try it server-side instead! Requires the 'mathjax-node-cli' npm package to be globally installed.", "name": "Server-Side MathJax",
"url": "https://github.com/mathjax/mathjax-node-cli/blob/master/package.json#L41", "description": "Client-side Mathjax via the 'enable_math_rendering' setting not your thing? Try it server-side instead! Requires the 'mathjax-node-cli' npm package to be globally installed.",
"cli": "tex2svg -- {input_text}", "url": "https:\/\/github.com\/mathjax\/mathjax-node-cli\/blob\/master\/package.json#L41",
"cli_mode": "substitution_pipe", "cli": "tex2svg -- {input_text}",
"output_format": "image/svg+xml" "cli_mode": "substitution_pipe",
} "output_format": "image\/svg+xml",
"output_classes": [ "invert-when-dark" ]
}
} }, } },
"parser_ext_time_limit": { "type": "number", "description": "The number of seconds external renderers are allowed to run for. Has no effect if external renderers are turned off. Also currently has no effect on Windows.", "default": 5 }, "parser_ext_time_limit": { "type": "number", "description": "The number of seconds external renderers are allowed to run for. Has no effect if external renderers are turned off. Also currently has no effect on Windows.", "default": 5 },
"parser_ext_allow_anon": { "type": "checkbox", "description": "<p>Whether to allow anonymous users to render new diagrams with the external renderer. When disabled, anonymous users will still be allowed to recall pre-rendered items from the cache, but will be unable to generate brand-new diagrams.</p><p>Note that if you allow anonymous edits this setting won't fully protect you: anonymous users could edit a page and insert a malicious diagram, and then laer a logged in user could unwittingly invoke the external renderer on the anonymous user's behalf.", "default": false }, "parser_ext_allow_anon": { "type": "checkbox", "description": "<p>Whether to allow anonymous users to render new diagrams with the external renderer. When disabled, anonymous users will still be allowed to recall pre-rendered items from the cache, but will be unable to generate brand-new diagrams.</p><p>Note that if you allow anonymous edits this setting won't fully protect you: anonymous users could edit a page and insert a malicious diagram, and then laer a logged in user could unwittingly invoke the external renderer on the anonymous user's behalf.", "default": false },

View file

@ -95,6 +95,8 @@
a:hover { color: hsl(214, 67%, 75%); } a:hover { color: hsl(214, 67%, 75%); }
a:active, a:focus { color: hsl(214, 87%, 85%); } a:active, a:focus { color: hsl(214, 87%, 85%); }
a:visited { color: hsl(264, 77%, 65%); } a:visited { color: hsl(264, 77%, 65%); }
.invert-when-dark { filter: invert(100%); }
} }
/* TODO: Refactor to use the CSS grid */ /* TODO: Refactor to use the CSS grid */