From 9b152c380f0c7049dc898869580be42a28832a04 Mon Sep 17 00:00:00 2001
From: "(GalaxyMaster)" This plugin is designed to work only for code blocks ( The primary functionality of the plugin does not require any configuration or additional classes or attributes, however to get the most of it you will need to provide additional CSS rules to dress things up. To keep the plugin as non-intrusive as possible the only extra CSS rules that are provided with the plugin are to introduce a wrapped line marker on the left side of the code block. See Examples on how disable this or change its behaviour.
+ This plugin wraps each physical line of the multi-line code block with The stylesheet provided with the plugin uses one pseudo-element ( Using just this plugin one can mimic the Line Numbers plugin output by adding the .comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}};
+var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"Augmented Backus–Naur form","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"Backus–Naur form","alias":"rbnf","aliasTitles":{"rbnf":"Routing Backus–Naur form"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cil":{"title":"CIL","owner":"sbrl"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"clojure":{"title":"Clojure","owner":"troglotit"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dax":{"title":"DAX","owner":"peterbud"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"ebnf":{"title":"Extended Backus–Naur form","owner":"RunDevelopment"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"http":{"title":"HTTP","optional":["css","javascript","json","markup"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup"],"owner":"RunDevelopment"},"json":{"title":"JSON","owner":"CupOfTea696"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mizar":{"title":"Mizar","owner":"Golmote"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nginx":{"title":"nginx","owner":"westonganger","require":"clike"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","markup-templating"],"owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","modify":["actionscript","coffeescript","flow","javascript","typescript","vala"],"owner":"RunDevelopment"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"solidity":{"title":"Solidity (Ethereum)","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"vala":{"title":"Vala","require":"clike","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":"vb","owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"lines":{"title":"Lines","description":"Introduces HTML markup around physical lines to allow styling of the particular line.","owner":"galaxy4public"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}};
if (typeof module !== 'undefined' && module.exports) { module.exports = components; }
\ No newline at end of file
diff --git a/components.json b/components.json
index 8a4f85865d..0ad2857ee3 100644
--- a/components.json
+++ b/components.json
@@ -1184,6 +1184,11 @@
"description": "Line number at the beginning of code lines.",
"owner": "kuba-kubula"
},
+ "lines": {
+ "title": "Lines",
+ "description": "Introduces HTML markup around physical lines to allow styling of the particular line.",
+ "owner": "galaxy4public"
+ },
"show-invisibles": {
"title": "Show Invisibles",
"description": "Show hidden characters such as tabs and line breaks.",
diff --git a/plugins/lines/index.html b/plugins/lines/index.html
new file mode 100644
index 0000000000..623af34ac7
--- /dev/null
+++ b/plugins/lines/index.html
@@ -0,0 +1,272 @@
+
+
+
+
+
+
+How to use
+
+ <pre><code>) and not for inline code.<div class="line"><a></a>...</div>, which allows to style the result quite extensively using only CSS.div.line::after) to display a visual marker for the wrapped lines. The examples below are also leveraging another pseudo element (div.line > a::before), which leaves two more pseudo-elements for you to style.line-numbers class to your desired <pre> or any of its ancestors, and by updating your CSS rules to include something along the following lines:
+
+ /* Visually backward compatible replacement of the line-numbers plugin :) */
+.line-numbers pre[class*="language-"],
+pre[class*="language-"].line-numbers {
+ counter-reset: linenumber;
+ counter-reset: linenumber var(--counter-start,0);
+ padding-left: 0;
+}
+
+.line-numbers pre[class*="language-"] > code,
+pre[class*="language-"].line-numbers > code {
+ padding-left: 3.8em;
+}
+
+.line-numbers pre[class*="language-"] div.line > a::before,
+pre[class*="language-"].line-numbers div.line > a::before {
+ content: counter(linenumber);
+ counter-increment: linenumber;
+ color: #999;
+ text-indent: 0;
+ text-align: right;
+ box-sizing: border-box;
+ left: -3.8em; /* make it -4.6em if your box-sizing is content-box */
+ display: block;
+ position: absolute;
+ width: 3em;
+ height: 100%;
+ padding-right: 0.8em;
+ border-right: solid #999;
+}
... and the browser will take care of the rest. To give all code blocks line numbers, add the line-numbers class to the <body> of the page.
Optional: You can specify the data-start (Number) attribute on the <pre> element. It will shift the line counter (if you are using the above CSS example).
Optional: To support multiline line numbers using soft wrap, apply the CSS white-space: pre-line; or white-space: pre-wrap; to your desired <pre>.
Optional: There is a rudimentary support for line highlighting and active line numbers, please see the corresponding examples below.
+
+
+ Please note that this Please note the Please note the Please note the how the following style:
+ Examples
+
+ JavaScript
+ <pre> does not have the line-numbers class but its parent does.CSS
+ data-start="-5" in the code below.HTML
+ style="white-space:pre-wrap;" in the code below and how it affects the wrapped lines.Unknown languages
+
can be used to highlight a line.#demo1 div.line:nth-of-type(3) {
+background: yellow;
+}
This raw text
+is not highlighted
+but it still has
+lines wrapped in <div>s, so we could benefit from the support this plugin provides such as nice visual line wrapping and the ability to select lines using CSS rules.
+
+The long and the following blank lines are here to demonstrate the wrapping of the long line.
+ A similar example but without Lines support (please note how plugin was selectively disabled for a particular block using the nolines class:
This raw text
+is not highlighted
+and it was explicitly
+excluded from being processed through the Lines plugin. The rendering of this block is exactly the same as if no Lines plugin was present. You may notice that the wrapping still happens due to the associated CSS class, though, yet it is hard to understand which line was wrapped and which was not.
+
+The long and the following blank lines are here to demonstrate the wrapping of the long line.
+
+ The location and presentation of the line wrap indicator can be easily customised by adjusting the div.line::after pseudo-element using CSS. For example, to relocate the indicator to the right side one could come up with something similar to the following stylesheet:
pre[class*="language-"] div.line {
+ padding-left: 0;
+ text-indent: 0;
+}
+
+pre[class*="language-"] div.line::after {
+ right: -1em;
+ bottom: 0;
+ left: auto;
+ top: auto;
+ width: 1.5em;
+ transform: none;
+}
+ The result of the applying the above style to a code block can be observed below:
+ +This raw text
+ has a very long line to demonstrate the relocation of the line wrapping indicator from the default left side to the right side of the block. It is just showcases what is possible when you have semantic representation of lines inside your <pre> blocks.
+
+ The empty line above is there for the demonstration purposes.
+
+ The indicator can be completely disabled by setting the display: none CSS property for the div.line::after pseudo-element, e.g. with the following stylesheet:
pre[class*="language-"] div.line::after {
+ display: none;
+}
+
+pre[class*="language-"] div.line {
+ padding-left: 0;
+ text-indent: 0;
+}
+
+#demo3 div.line:nth-of-type(2) {
+ background: yellow;
+}
+ To demonstrate that the Lines plugin still did its work the highlighting of the second line was added to the above stylesheet. The resulting rendering of a block looks as follows: + +
This raw text
+demonstrates that the line wrapping indicator can be completely disabled and you will get the same experience as like no Lines plugin was there.
+
+However, as you can see above, the lines are still semantically represented and are addressable using CSS.
+
+ There is a basic support for active line numbers, i.e. when the user clicks on the line number (if the line numbers are displayed) and the location bar is updated with the hash fragment corresponding to the line clicked.
+The Lines plugin provides bare minimum to support the active line numbers, the user still need to do some preparation work. Following are conditions for working with the active line numbers in the Lines plugin: +
id attribute of the enclosing <pre> element;<div><a>...</div></a> each <div> is assigned an id which is a composition of <pre>'s id and the corresponding line number joined by .;This means that without any additional configuration the Lines plugin provides a rudimentary support for linking lines and code blocks (e.g. this mimics what the Line Highlight plugin does with the linkable-line-numbers option)
However, the problem with that approach is that when somebody is following such a URL that points to a very deeply burrowed code block on a large page, chances are that PrismJS won't be able to modify the DOM tree in time to let the browser "see" the target.
+One way of addressing the issue would be to pre-generate the structure inside the codeblock, so it is stable from the browser perspective, i.e. wrap all physical lines with <div><a> as the Lines plugin does and ensure that the ids are properly assigned to the <divs.
+
Below is a non-working(*) demonstration of the active line numbers functionality, it uses the example stylesheet that was presented at the start of this page. You still can reference a line using a fragment (e.g. clicking this will point you to line 3), but since the page is using <base href="../.." /> one can forget of using fragments without page reloads.
The following style rules were added to make the experience a bit more pleasant:
+.line-numbers pre[class*="language-"][id] div.line > a::before,
+pre[class*="language-"][id].line-numbers div.line > a::before {
+ cursor: pointer;
+ pointer-events: auto;
+}
+
+.line-numbers pre[class*="language-"][id] div.line > a:hover::before,
+pre[class*="language-"][id].line-numbers div.line > a:hover::before {
+ color: black;
+ background: rgba(0,0,0,.1);
+}
+
+/* add visual assist for demo purposes */
+#demo4 *:target {
+ background-color: #0000ff24;
+}
+
+ All this combined renders as follows:
+ This is a demo code block to demonstrate the basic active line numbering functionality of the Lines plugin.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/lines/prism-lines.css b/plugins/lines/prism-lines.css
new file mode 100644
index 0000000000..84e51440bf
--- /dev/null
+++ b/plugins/lines/prism-lines.css
@@ -0,0 +1,88 @@
+pre[class*="language"] > code {
+ position: relative;
+ display: block;
+}
+
+pre[class*="language"] div.line {
+ position: relative;
+ display: block;
+ height: 100%;
+ line-height: inherit;
+ text-indent: -1.5em;
+ padding-left: 1.5em;
+}
+pre[class*="language-"] div.line::after {
+ content: '';
+ position: absolute;
+ display: block;
+ top: 0;
+ left: .5em;
+ width: 100%;
+ height: 100%;
+ text-indent: 0;
+ background:
+ url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI0IDI0Ij48dGV4dCB4PSIwIiB5PSIxOSI+JiN4MjNjZTs8L3RleHQ+PC9zdmc+Cg==)
+ no-repeat repeat;
+ background-size: 1.5em 1.5em;
+ clip: rect(1.5em 1.5em 100vh 0);
+ opacity: .5;
+ transform: rotateY(180deg);
+ transform-origin: left;
+}
+
+/*** The following sample CSS code is disabled by default in order not to
+ * angry lots of people since it kind of taps into other plugins' territory.
+ * It is recommended to add the rules in the commented block below to your
+ * local to your project CSS rule set and get the benefits described in the
+ * plugin documentation.
+ ***/
+
+/* Visually backward compatible replacement of the line-numbers plugin :) */
+/*
+.line-numbers pre[class*="language-"],
+pre[class*="language-"].line-numbers {
+ counter-reset: linenumber;
+ counter-reset: linenumber var(--counter-start,0);
+ padding-left: 0;
+}
+
+pre[class*="language-"] > code {
+ white-space: inherit;
+}
+
+.line-numbers pre[class*="language-"] > code,
+pre[class*="language-"].line-numbers > code {
+ padding-left: 3.8em;
+}
+
+.line-numbers pre[class*="language-"] div.line > a::before,
+pre[class*="language-"].line-numbers div.line > a::before {
+ content: counter(linenumber);
+ box-sizing: border-box;
+ counter-increment: linenumber;
+ color: #999;
+ text-indent: 0;
+ text-align: right;
+ left: -3.8em;
+ display: block;
+ position: absolute;
+ width: 3em;
+ height: 100%;
+ padding-right: .8em;
+ border-right: solid #999;
+ cursor: default;
+ pointer-events: none;
+}
+
+.line-numbers pre[class*="language-"][id] div.line > a::before,
+pre[class*="language-"][id].line-numbers div.line > a::before {
+ cursor: pointer;
+ pointer-events: auto;
+}
+
+.line-numbers pre[class*="language-"][id] div.line > a:hover::before,
+pre[class*="language-"][id].line-numbers div.line > a:hover::before {
+ color: black;
+ background: rgba(0,0,0,.1);
+}
+*/
diff --git a/plugins/lines/prism-lines.js b/plugins/lines/prism-lines.js
new file mode 100644
index 0000000000..863024921e
--- /dev/null
+++ b/plugins/lines/prism-lines.js
@@ -0,0 +1,69 @@
+(function () {
+
+ if (typeof self === 'undefined' || !self.Prism || !self.document) {
+ return;
+ }
+
+ /**
+ * Returns style declarations for the element
+ * @param {Element} element
+ */
+ Prism.hooks.add('before-insert', function (env) {
+ // no grammar -> no highlighting yet
+ /*
+ if (!env.grammar) {
+ return;
+ }
+ */
+ /**
+ * Returns whether the given element has the given class.
+ *
+ * @param {Element} element
+ * @param {string} className
+ * @returns {boolean}
+ */
+ function hasClass(element, className) {
+ className = " " + className + " ";
+ return (" " + element.className + " ")
+ .replace(/[\n\t]/g, " ")
+ .indexOf(className) > -1
+ }
+
+ // works only for wrapped inside (not inline)
+ var pre = env.element.parentNode;
+ if (!pre || !/pre/i.test(pre.nodeName)) {
+ return;
+ }
+
+ // we are not welcome here :(
+ if (hasClass(pre, 'nolines')) {
+ return;
+ }
+
+ // support for line-numbers behaviour
+ var dataStart = 1;
+ if (pre.hasAttribute('data-start')) {
+ dataStart = parseInt(pre.getAttribute('data-start'), 10);
+ if (isNaN(dataStart)) {
+ dataStart = 1;
+ }
+ pre.style.setProperty('--counter-start', dataStart - 1);
+ }
+
+ // wrap each line in
+ // - we need the a tag to enable active line numbers support
+ var line = dataStart;
+ var fragment = pre.id ? pre.id + '.' : null;
+ env.highlightedCode =
+ '' +
+ '' +
+ env.highlightedCode.replace(/\n/g,
+ function(match, offset, string) {
+ line++;
+ return (match +
+ '';
+ });
+}());
diff --git a/plugins/lines/prism-lines.min.js b/plugins/lines/prism-lines.min.js
new file mode 100644
index 0000000000..6a53278d0b
--- /dev/null
+++ b/plugins/lines/prism-lines.min.js
@@ -0,0 +1 @@
+"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("before-insert",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&(i=" "+(i="nolines")+" ",!(-1<(" "+t.className+" ").replace(/[\n\t]/g," ").indexOf(i)))){var i,a=1;t.hasAttribute("data-start")&&(a=parseInt(t.getAttribute("data-start"),10),isNaN(a)&&(a=1),t.style.setProperty("--counter-start",a-1));var r=a,s=t.id?t.id+".":null;e.highlightedCode=""}});
\ No newline at end of file
From a49ff5218a4c1e9834c85f35ebeb58fd077efeb3 Mon Sep 17 00:00:00 2001
From: "(GalaxyMaster)"
Date: Sun, 17 May 2020 04:34:07 +1000
Subject: [PATCH 02/11] made class selectors a bit more specific
---
plugins/lines/prism-lines.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/lines/prism-lines.css b/plugins/lines/prism-lines.css
index 84e51440bf..144fbfb94e 100644
--- a/plugins/lines/prism-lines.css
+++ b/plugins/lines/prism-lines.css
@@ -1,9 +1,9 @@
-pre[class*="language"] > code {
+pre[class*="language-"] > code {
position: relative;
display: block;
}
-pre[class*="language"] div.line {
+pre[class*="language-"] div.line {
position: relative;
display: block;
height: 100%;
From 89486e0b22444a4e306c7e0c56291233e0eac3cf Mon Sep 17 00:00:00 2001
From: "(GalaxyMaster)"
Date: Sun, 17 May 2020 19:16:20 +1000
Subject: [PATCH 03/11] Reworked to actually parse the content
---
plugins/lines/prism-lines.css | 1 +
plugins/lines/prism-lines.js | 133 +++++++++++++++++++++++--------
plugins/lines/prism-lines.min.js | 2 +-
3 files changed, 100 insertions(+), 36 deletions(-)
diff --git a/plugins/lines/prism-lines.css b/plugins/lines/prism-lines.css
index 144fbfb94e..d8ecce969d 100644
--- a/plugins/lines/prism-lines.css
+++ b/plugins/lines/prism-lines.css
@@ -1,3 +1,4 @@
+/* Protects from themes that mess the code block up */
pre[class*="language-"] > code {
position: relative;
display: block;
diff --git a/plugins/lines/prism-lines.js b/plugins/lines/prism-lines.js
index 863024921e..5250871156 100644
--- a/plugins/lines/prism-lines.js
+++ b/plugins/lines/prism-lines.js
@@ -9,25 +9,6 @@
* @param {Element} element
*/
Prism.hooks.add('before-insert', function (env) {
- // no grammar -> no highlighting yet
- /*
- if (!env.grammar) {
- return;
- }
- */
- /**
- * Returns whether the given element has the given class.
- *
- * @param {Element} element
- * @param {string} className
- * @returns {boolean}
- */
- function hasClass(element, className) {
- className = " " + className + " ";
- return (" " + element.className + " ")
- .replace(/[\n\t]/g, " ")
- .indexOf(className) > -1
- }
// works only for wrapped inside (not inline)
var pre = env.element.parentNode;
@@ -36,7 +17,7 @@
}
// we are not welcome here :(
- if (hasClass(pre, 'nolines')) {
+ if (pre.className.includes('nolines')) {
return;
}
@@ -50,20 +31,102 @@
pre.style.setProperty('--counter-start', dataStart - 1);
}
- // wrap each line in
- // - we need the a tag to enable active line numbers support
- var line = dataStart;
- var fragment = pre.id ? pre.id + '.' : null;
- env.highlightedCode =
- '' +
- '' +
- env.highlightedCode.replace(/\n/g,
- function(match, offset, string) {
- line++;
- return (match +
- '';
+ function createLine(lineNumber, prefix) {
+ var line = document.createElement('div');
+ var anchor = document.createElement('a');
+ if (prefix) {
+ var target = prefix + '.' + lineNumber;
+ line.id = target;
+ anchor.href = '#' + target;
+ }
+ line.setAttribute('class', 'line');
+ line.appendChild(anchor);
+ return line;
+ }
+
+ function splitNode(node) {
+ if (node.hasChildNodes()) {
+ // so we've got a kid! :)
+ var p1 = document.createElement(node.nodeName);
+ var p2 = document.createElement(node.nodeName);
+ if (node.hasAttributes()) {
+ for (i = 0; i < node.attributes.length ; i++) {
+ var key = node.attributes.item(i).name;
+ var value = node.attributes.item(i).value;
+ p1.setAttribute(key, value);
+ p2.setAttribute(key, value);
+ }
+ }
+ var kid = node.firstChild;
+
+ // skip all non-interesting kids
+ while (kid && !/\n/.test(kid.textContent)) {
+ p1.appendChild(kid.cloneNode(true));
+ kid = kid.nextSibling;
+ }
+
+ if (kid && /\n/.test(kid.textContent)) {
+ // found a special one :)
+ var pair = splitNode(kid);
+ p1.appendChild(pair[0]);
+ if (pair[1])
+ p2.appendChild(pair[1]);
+ }
+
+ return [ p1, p2 ];
+ }
+
+ // we are at the bottom of the hierarchy
+ switch (node.nodeType) {
+ case Node.TEXT_NODE:
+ var newLine = node.textContent.indexOf('\n');
+ if (newLine == -1 || newLine == node.textContent.length - 1)
+ return [ node, null ];
+ return [
+ document.createTextNode(node.textContent.slice(0, newLine + 1)),
+ document.createTextNode(node.textContent.slice(newLine + 1))
+ ];
+ break;
+ default:
+ console.warn('Lines plugin: encountered unexpected node type ', node.nodeType, ', please report this as bug.');
+ return [ node, null ]; // no splitting, safe
+ }
+ }
+
+ var parser = new DOMParser();
+ var highlightedCode = parser.parseFromString(env.highlightedCode, 'text/html');
+ var wrapped = new DocumentFragment();
+ var lineNumber = dataStart;
+ var line = createLine(lineNumber++, pre.id)
+ var currentNode = highlightedCode.body.firstChild;
+ while (currentNode && wrapped.children.length < 100) {
+ // quick test for embedded lines
+ if (/\n/.test(currentNode.textContent)) {
+ var detached = currentNode.cloneNode(true);
+ while (detached && /\n/.test(detached.textContent)) {
+ var pair = splitNode(detached);
+ line.appendChild(pair[0]);
+ wrapped.appendChild(line);
+ line = createLine(lineNumber++, pre.id);
+ detached = pair[1];
+ }
+ if (detached)
+ line.appendChild(detached);
+ }
+ else {
+ line.appendChild(currentNode.cloneNode(true));
+ }
+ currentNode = currentNode.nextSibling;
+ }
+
+ // if there is an uncommited line, commit it
+ if (line.children.length > 1)
+ wrapped.appendChild(line);
+
+ if (wrapped.children) {
+ env.highlightedCode = '';
+ for (i = 0; i < wrapped.children.length; i++)
+ env.highlightedCode += wrapped.children[i].outerHTML;
+ }
});
}());
diff --git a/plugins/lines/prism-lines.min.js b/plugins/lines/prism-lines.min.js
index 6a53278d0b..ffa0c1ff8b 100644
--- a/plugins/lines/prism-lines.min.js
+++ b/plugins/lines/prism-lines.min.js
@@ -1 +1 @@
-"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("before-insert",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&(i=" "+(i="nolines")+" ",!(-1<(" "+t.className+" ").replace(/[\n\t]/g," ").indexOf(i)))){var i,a=1;t.hasAttribute("data-start")&&(a=parseInt(t.getAttribute("data-start"),10),isNaN(a)&&(a=1),t.style.setProperty("--counter-start",a-1));var r=a,s=t.id?t.id+".":null;e.highlightedCode=""}});
\ No newline at end of file
+"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("before-insert",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&!t.className.includes("nolines")){var n=1;t.hasAttribute("data-start")&&(n=parseInt(t.getAttribute("data-start"),10),isNaN(n)&&(n=1),t.style.setProperty("--counter-start",n-1));for(var r=(new DOMParser).parseFromString(e.highlightedCode,"text/html"),d=new DocumentFragment,a=n,o=c(a++,t.id),l=r.body.firstChild;l&&d.children.length<100;){if(/\n/.test(l.textContent)){for(var s=l.cloneNode(!0);s&&/\n/.test(s.textContent);){var h=u(s);o.appendChild(h[0]),d.appendChild(o),o=c(a++,t.id),s=h[1]}s&&o.appendChild(s)}else o.appendChild(l.cloneNode(!0));l=l.nextSibling}if(1
Date: Sun, 17 May 2020 19:16:20 +1000
Subject: [PATCH 04/11] Reworked to actually parse the content
---
plugins/lines/prism-lines.css | 1 +
plugins/lines/prism-lines.js | 133 +++++++++++++++++++++++--------
plugins/lines/prism-lines.min.js | 2 +-
3 files changed, 100 insertions(+), 36 deletions(-)
diff --git a/plugins/lines/prism-lines.css b/plugins/lines/prism-lines.css
index 144fbfb94e..d8ecce969d 100644
--- a/plugins/lines/prism-lines.css
+++ b/plugins/lines/prism-lines.css
@@ -1,3 +1,4 @@
+/* Protects from themes that mess the code block up */
pre[class*="language-"] > code {
position: relative;
display: block;
diff --git a/plugins/lines/prism-lines.js b/plugins/lines/prism-lines.js
index 863024921e..5f953cdbd3 100644
--- a/plugins/lines/prism-lines.js
+++ b/plugins/lines/prism-lines.js
@@ -9,25 +9,6 @@
* @param {Element} element
*/
Prism.hooks.add('before-insert', function (env) {
- // no grammar -> no highlighting yet
- /*
- if (!env.grammar) {
- return;
- }
- */
- /**
- * Returns whether the given element has the given class.
- *
- * @param {Element} element
- * @param {string} className
- * @returns {boolean}
- */
- function hasClass(element, className) {
- className = " " + className + " ";
- return (" " + element.className + " ")
- .replace(/[\n\t]/g, " ")
- .indexOf(className) > -1
- }
// works only for wrapped inside (not inline)
var pre = env.element.parentNode;
@@ -36,7 +17,7 @@
}
// we are not welcome here :(
- if (hasClass(pre, 'nolines')) {
+ if (pre.className.includes('nolines')) {
return;
}
@@ -50,20 +31,102 @@
pre.style.setProperty('--counter-start', dataStart - 1);
}
- // wrap each line in
- // - we need the a tag to enable active line numbers support
- var line = dataStart;
- var fragment = pre.id ? pre.id + '.' : null;
- env.highlightedCode =
- '' +
- '' +
- env.highlightedCode.replace(/\n/g,
- function(match, offset, string) {
- line++;
- return (match +
- '';
+ function createLine(lineNumber, prefix) {
+ var line = document.createElement('div');
+ var anchor = document.createElement('a');
+ if (prefix) {
+ var target = prefix + '.' + lineNumber;
+ line.id = target;
+ anchor.href = '#' + target;
+ }
+ line.setAttribute('class', 'line');
+ line.appendChild(anchor);
+ return line;
+ }
+
+ function splitNode(node) {
+ if (node.hasChildNodes()) {
+ // so we've got a kid! :)
+ var p1 = document.createElement(node.nodeName);
+ var p2 = document.createElement(node.nodeName);
+ if (node.hasAttributes()) {
+ for (i = 0; i < node.attributes.length ; i++) {
+ var key = node.attributes.item(i).name;
+ var value = node.attributes.item(i).value;
+ p1.setAttribute(key, value);
+ p2.setAttribute(key, value);
+ }
+ }
+ var kid = node.firstChild;
+
+ // skip all non-interesting kids
+ while (kid && !/\n/.test(kid.textContent)) {
+ p1.appendChild(kid.cloneNode(true));
+ kid = kid.nextSibling;
+ }
+
+ if (kid && /\n/.test(kid.textContent)) {
+ // found a special one :)
+ var pair = splitNode(kid);
+ p1.appendChild(pair[0]);
+ if (pair[1])
+ p2.appendChild(pair[1]);
+ }
+
+ return [ p1, p2 ];
+ }
+
+ // we are at the bottom of the hierarchy
+ switch (node.nodeType) {
+ case Node.TEXT_NODE:
+ var newLine = node.textContent.indexOf('\n');
+ if (newLine == -1 || newLine == node.textContent.length - 1)
+ return [ node, null ];
+ return [
+ document.createTextNode(node.textContent.slice(0, newLine + 1)),
+ document.createTextNode(node.textContent.slice(newLine + 1))
+ ];
+ break;
+ default:
+ console.warn('Lines plugin: encountered unexpected node type ', node.nodeType, ', please report this as bug.');
+ return [ node, null ]; // no splitting, safe
+ }
+ }
+
+ var parser = new DOMParser();
+ var highlightedCode = parser.parseFromString(env.highlightedCode, 'text/html');
+ var wrapped = new DocumentFragment();
+ var lineNumber = dataStart;
+ var line = createLine(lineNumber++, pre.id)
+ var currentNode = highlightedCode.body.firstChild;
+ while (currentNode) {
+ // quick test for embedded lines
+ if (/\n/.test(currentNode.textContent)) {
+ var detached = currentNode.cloneNode(true);
+ while (detached && /\n/.test(detached.textContent)) {
+ var pair = splitNode(detached);
+ line.appendChild(pair[0]);
+ wrapped.appendChild(line);
+ line = createLine(lineNumber++, pre.id);
+ detached = pair[1];
+ }
+ if (detached)
+ line.appendChild(detached);
+ }
+ else {
+ line.appendChild(currentNode.cloneNode(true));
+ }
+ currentNode = currentNode.nextSibling;
+ }
+
+ // if there is an uncommited line, commit it
+ if (line.children.length > 1)
+ wrapped.appendChild(line);
+
+ if (wrapped.children) {
+ env.highlightedCode = '';
+ for (i = 0; i < wrapped.children.length; i++)
+ env.highlightedCode += wrapped.children[i].outerHTML;
+ }
});
}());
diff --git a/plugins/lines/prism-lines.min.js b/plugins/lines/prism-lines.min.js
index 6a53278d0b..ffa0c1ff8b 100644
--- a/plugins/lines/prism-lines.min.js
+++ b/plugins/lines/prism-lines.min.js
@@ -1 +1 @@
-"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("before-insert",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&(i=" "+(i="nolines")+" ",!(-1<(" "+t.className+" ").replace(/[\n\t]/g," ").indexOf(i)))){var i,a=1;t.hasAttribute("data-start")&&(a=parseInt(t.getAttribute("data-start"),10),isNaN(a)&&(a=1),t.style.setProperty("--counter-start",a-1));var r=a,s=t.id?t.id+".":null;e.highlightedCode=""}});
\ No newline at end of file
+"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("before-insert",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&!t.className.includes("nolines")){var n=1;t.hasAttribute("data-start")&&(n=parseInt(t.getAttribute("data-start"),10),isNaN(n)&&(n=1),t.style.setProperty("--counter-start",n-1));for(var r=(new DOMParser).parseFromString(e.highlightedCode,"text/html"),d=new DocumentFragment,a=n,o=c(a++,t.id),l=r.body.firstChild;l&&d.children.length<100;){if(/\n/.test(l.textContent)){for(var s=l.cloneNode(!0);s&&/\n/.test(s.textContent);){var h=u(s);o.appendChild(h[0]),d.appendChild(o),o=c(a++,t.id),s=h[1]}s&&o.appendChild(s)}else o.appendChild(l.cloneNode(!0));l=l.nextSibling}if(1
Date: Sun, 17 May 2020 19:24:34 +1000
Subject: [PATCH 05/11] Forgot to run "gulp" :(
---
plugins/lines/prism-lines.min.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/lines/prism-lines.min.js b/plugins/lines/prism-lines.min.js
index ffa0c1ff8b..d92639c570 100644
--- a/plugins/lines/prism-lines.min.js
+++ b/plugins/lines/prism-lines.min.js
@@ -1 +1 @@
-"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("before-insert",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&!t.className.includes("nolines")){var n=1;t.hasAttribute("data-start")&&(n=parseInt(t.getAttribute("data-start"),10),isNaN(n)&&(n=1),t.style.setProperty("--counter-start",n-1));for(var r=(new DOMParser).parseFromString(e.highlightedCode,"text/html"),d=new DocumentFragment,a=n,o=c(a++,t.id),l=r.body.firstChild;l&&d.children.length<100;){if(/\n/.test(l.textContent)){for(var s=l.cloneNode(!0);s&&/\n/.test(s.textContent);){var h=u(s);o.appendChild(h[0]),d.appendChild(o),o=c(a++,t.id),s=h[1]}s&&o.appendChild(s)}else o.appendChild(l.cloneNode(!0));l=l.nextSibling}if(1
Date: Sun, 17 May 2020 21:54:52 +1000
Subject: [PATCH 06/11] Removed erroneous check that was resulting in one-liner
raw text blocks to be empty
---
plugins/lines/prism-lines.js | 5 +----
plugins/lines/prism-lines.min.js | 2 +-
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/plugins/lines/prism-lines.js b/plugins/lines/prism-lines.js
index 73e053fbcd..2046139452 100644
--- a/plugins/lines/prism-lines.js
+++ b/plugins/lines/prism-lines.js
@@ -119,10 +119,7 @@
}
currentNode = currentNode.nextSibling;
}
-
- // if there is an uncommited line, commit it
- if (line.children.length > 1)
- wrapped.appendChild(line);
+ wrapped.appendChild(line);
if (wrapped.children) {
env.highlightedCode = '';
diff --git a/plugins/lines/prism-lines.min.js b/plugins/lines/prism-lines.min.js
index d92639c570..ae53757d30 100644
--- a/plugins/lines/prism-lines.min.js
+++ b/plugins/lines/prism-lines.min.js
@@ -1 +1 @@
-"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("before-insert",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&!t.className.includes("nolines")){var n=1;t.hasAttribute("data-start")&&(n=parseInt(t.getAttribute("data-start"),10),isNaN(n)&&(n=1),t.style.setProperty("--counter-start",n-1));for(var r=(new DOMParser).parseFromString(e.highlightedCode,"text/html"),d=new DocumentFragment,a=n,o=u(a++,t.id),l=r.body.firstChild;l;){if(/\n/.test(l.textContent)){for(var s=l.cloneNode(!0);s&&/\n/.test(s.textContent);){var h=c(s);o.appendChild(h[0]),d.appendChild(o),o=u(a++,t.id),s=h[1]}s&&o.appendChild(s)}else o.appendChild(l.cloneNode(!0));l=l.nextSibling}if(1
Date: Tue, 19 May 2020 01:30:27 +0200
Subject: [PATCH 07/11] Changed title and description
---
components.js | 2 +-
components.json | 2 +-
plugins/lines/index.html | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/components.js b/components.js
index 214a1a292c..d0195a6327 100644
--- a/components.js
+++ b/components.js
@@ -1,2 +1,2 @@
-var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"Augmented Backus–Naur form","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"Backus–Naur form","alias":"rbnf","aliasTitles":{"rbnf":"Routing Backus–Naur form"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cil":{"title":"CIL","owner":"sbrl"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"clojure":{"title":"Clojure","owner":"troglotit"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dax":{"title":"DAX","owner":"peterbud"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"ebnf":{"title":"Extended Backus–Naur form","owner":"RunDevelopment"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"http":{"title":"HTTP","optional":["css","javascript","json","markup"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mizar":{"title":"Mizar","owner":"Golmote"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nginx":{"title":"nginx","owner":"westonganger","require":"clike"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","markup-templating"],"owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","modify":["actionscript","coffeescript","flow","javascript","typescript","vala"],"owner":"RunDevelopment"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"solidity":{"title":"Solidity (Ethereum)","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"vala":{"title":"Vala","require":"clike","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":"vb","owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"lines":{"title":"Lines","description":"Introduces HTML markup around physical lines to allow styling of the particular line.","owner":"galaxy4public"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}};
+var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"Augmented Backus–Naur form","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"Backus–Naur form","alias":"rbnf","aliasTitles":{"rbnf":"Routing Backus–Naur form"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cil":{"title":"CIL","owner":"sbrl"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"clojure":{"title":"Clojure","owner":"troglotit"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dax":{"title":"DAX","owner":"peterbud"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"ebnf":{"title":"Extended Backus–Naur form","owner":"RunDevelopment"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"http":{"title":"HTTP","optional":["css","javascript","json","markup"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mizar":{"title":"Mizar","owner":"Golmote"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nginx":{"title":"nginx","owner":"westonganger","require":"clike"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","markup-templating"],"owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","modify":["actionscript","coffeescript","flow","javascript","typescript","vala"],"owner":"RunDevelopment"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"solidity":{"title":"Solidity (Ethereum)","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"vala":{"title":"Vala","require":"clike","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":"vb","owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"lines":{"title":"Lines","description":"Creates a wrapper element for every line.","owner":"galaxy4public"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}};
if (typeof module !== 'undefined' && module.exports) { module.exports = components; }
\ No newline at end of file
diff --git a/components.json b/components.json
index 5f828da39f..b1832783b6 100644
--- a/components.json
+++ b/components.json
@@ -1193,7 +1193,7 @@
},
"lines": {
"title": "Lines",
- "description": "Introduces HTML markup around physical lines to allow styling of the particular line.",
+ "description": "Creates a wrapper element for every line.",
"owner": "galaxy4public"
},
"show-invisibles": {
diff --git a/plugins/lines/index.html b/plugins/lines/index.html
index 623af34ac7..213b632b27 100644
--- a/plugins/lines/index.html
+++ b/plugins/lines/index.html
@@ -4,7 +4,7 @@
-Line Numbers ▲ Prism plugins
+Lines ▲ Prism plugins
From 4402537938cd69526122ffadbe04fbe3d6b1f2e1 Mon Sep 17 00:00:00 2001
From: RunDevelopment
Date: Tue, 19 May 2020 01:35:36 +0200
Subject: [PATCH 08/11] Improved implementation and added tests
---
plugins/lines/prism-lines.js | 262 +++++++++++++++++++------------
plugins/lines/prism-lines.min.js | 2 +-
tests/plugins/lines/test.js | 115 ++++++++++++++
3 files changed, 280 insertions(+), 99 deletions(-)
create mode 100644 tests/plugins/lines/test.js
diff --git a/plugins/lines/prism-lines.js b/plugins/lines/prism-lines.js
index 2046139452..fb66383e18 100644
--- a/plugins/lines/prism-lines.js
+++ b/plugins/lines/prism-lines.js
@@ -1,3 +1,5 @@
+// Original author: https://github.com/galaxy4public
+
(function () {
if (typeof self === 'undefined' || !self.Prism || !self.document) {
@@ -5,126 +7,190 @@
}
/**
- * Returns style declarations for the element
+ * Removes all child nodes of the given element and returns the removed nodes in order.
+ *
* @param {Element} element
+ * @returns {Node[]}
*/
- Prism.hooks.add('before-insert', function (env) {
+ function clearChildNodes(element) {
+ /** @type {Node[]} */
+ var nodes = [];
- // works only for wrapped inside (not inline)
- var pre = env.element.parentNode;
- if (!pre || !/pre/i.test(pre.nodeName)) {
- return;
+ var first;
+ while (first = element.firstChild) {
+ nodes.push(first);
+ element.removeChild(first);
}
- // we are not welcome here :(
- if (pre.className.includes('nolines')) {
- return;
+ return nodes;
+ }
+
+ /**
+ * Transfers the `count` last child nodes from `from` to `to` by appending them.
+ *
+ * @param {Element} from
+ * @param {Element} to
+ * @param {number} count
+ */
+ function transferLastChildNodes(from, to, count) {
+ /** @type {Node[]} */
+ var nodes = [];
+
+ while (count-- !== 0) {
+ nodes.push(from.removeChild(from.lastChild));
}
- // support for line-numbers behaviour
- var dataStart = 1;
- if (pre.hasAttribute('data-start')) {
- dataStart = parseInt(pre.getAttribute('data-start'), 10);
- if (isNaN(dataStart)) {
- dataStart = 1;
- }
- pre.style.setProperty('--counter-start', dataStart - 1);
- }
-
- function createLine(lineNumber, prefix) {
- var line = document.createElement('div');
- var anchor = document.createElement('a');
- if (prefix) {
- var target = prefix + '.' + lineNumber;
- line.id = target;
- anchor.href = '#' + target;
- }
- line.setAttribute('class', 'line');
- line.appendChild(anchor);
- return line;
+ // nodes are in reversed order
+ for (var i = nodes.length - 1; i >= 0; i--) {
+ to.append(nodes[i]);
}
+ }
+
+ /** @type {Readonly} */
+ var NO_SPLIT = {};
+ /** @type {Readonly} */
+ var NO_SPLIT_NEWLINE = { newline: true };
+
+ /**
+ * Modifies the given node such that its `textContent` is exactly one line.
+ *
+ * The `newline` property of the returned `SplitResult` is `true` if the given node contains a newline.
+ * The `rest` property is only defined if `newline` is `true` and, if defined, contains a node representing the
+ * rest of the text content (plus tags).
+ *
+ * If `newline` is `true` and `rest` is undefined, then the given contains exactly one line terminated by a single
+ * newline.
+ *
+ * @param {Node} node
+ * @param {Document} document
+ * @returns {Readonly}
+ *
+ * @typedef SplitResult
+ * @property {boolean | undefined} [newline] If `newline` is `false`, then `rest` will be `undefined`.
+ * @property {Node | undefined} [rest]
+ */
+ function splitNode(node, document) {
+ switch (node.nodeType) {
+ case Node.ELEMENT_NODE:
+ var element = /** @type {Element} */ (node);
+
+ for (var i = 0, l = element.childNodes.length; i < l; i++) {
+ var child = element.childNodes[i];
+ var res = splitNode(child, document);
- function splitNode(node) {
- if (node.hasChildNodes()) {
- // so we've got a kid! :)
- var p1 = document.createElement(node.nodeName);
- var p2 = document.createElement(node.nodeName);
- if (node.hasAttributes()) {
- for (i = 0; i < node.attributes.length ; i++) {
- var key = node.attributes.item(i).name;
- var value = node.attributes.item(i).value;
- p1.setAttribute(key, value);
- p2.setAttribute(key, value);
+ if (res.newline) {
+ if (!res.rest && i === l - 1) {
+ // This child is the last child and ends with a newline and nothing after it.
+ // Example: foo\n
+ return NO_SPLIT_NEWLINE;
+ }
+
+ // create a copy of the element without any child nodes (shallow copy)
+ var restElement = /** @type {Element} */ (element.cloneNode(false));
+
+ // append the rest of the split result of the current child to the new element
+ if (res.rest) {
+ restElement.append(res.rest);
+ }
+ // append all child nodes of the current child to the new element
+ transferLastChildNodes(element, restElement, l - i - 1);
+
+ return { newline: true, rest: restElement };
}
}
- var kid = node.firstChild;
- // skip all non-interesting kids
- while (kid && !/\n/.test(kid.textContent)) {
- p1.appendChild(kid.cloneNode(true));
- kid = kid.nextSibling;
- }
+ // This will be reached if the element has no children or none of the children contains a newline.
+ // Example: foo
+ return NO_SPLIT;
+
+ case Node.TEXT_NODE:
+ var text = /** @type {Text} */ (node);
+
+ var newlineIndex = text.data.indexOf('\n');
+ if (newlineIndex === -1) {
+ // This text does not contain a newline.
+ return NO_SPLIT;
- if (kid && /\n/.test(kid.textContent)) {
- // found a special one :)
- var pair = splitNode(kid);
- p1.appendChild(pair[0]);
- if (pair[1])
- p2.appendChild(pair[1]);
+ } else if (newlineIndex === text.data.length - 1) {
+ // This text ends a line with nothing after it.
+ return NO_SPLIT_NEWLINE;
+
+ } else {
+ // This text contains a newlines and there are some characters after the first line.
+ var restText = text.splitText(newlineIndex + 1);
+ return { newline: true, rest: restText };
}
- return [ p1, p2 ];
- }
+ default:
+ // In all other cases, we will just assume that the node doesn't contribute to the textContent and
+ // therefore cannot contain newlines. Example: comments.
+ return NO_SPLIT;
+ }
+ }
- // we are at the bottom of the hierarchy
- switch (node.nodeType) {
- case Node.TEXT_NODE:
- var newLine = node.textContent.indexOf('\n');
- if (newLine == -1 || newLine == node.textContent.length - 1)
- return [ node, null ];
- return [
- document.createTextNode(node.textContent.slice(0, newLine + 1)),
- document.createTextNode(node.textContent.slice(newLine + 1))
- ];
- break;
- default:
- console.warn('Lines plugin: encountered unexpected node type ', node.nodeType, ', please report this as bug.');
- return [ node, null ]; // no splitting, safe
- }
+
+ Prism.hooks.add('before-insert', function (env) {
+ // works only for wrapped inside (not inline)
+
+ /** @type {HTMLPreElement} */
+ var pre = env.element.parentNode;
+ if (!pre || !/^pre$/i.test(pre.nodeName)) {
+ return;
}
- var parser = new DOMParser();
- var highlightedCode = parser.parseFromString(env.highlightedCode, 'text/html');
- var wrapped = new DocumentFragment();
- var lineNumber = dataStart;
- var line = createLine(lineNumber++, pre.id)
- var currentNode = highlightedCode.body.firstChild;
-
- while (currentNode) {
- // quick test for embedded lines
- if (/\n/.test(currentNode.textContent)) {
- var detached = currentNode.cloneNode(true);
- while (detached && /\n/.test(detached.textContent)) {
- var pair = splitNode(detached);
- line.appendChild(pair[0]);
- wrapped.appendChild(line);
- line = createLine(lineNumber++, pre.id);
- detached = pair[1];
+ var dom = new DOMParser().parseFromString(env.highlightedCode, 'text/html');
+ var domNodesReversed = clearChildNodes(dom.body).reverse();
+ var wrapper = dom.createElement('div');
+
+ /**
+ * @param {readonly Node[]} childNodes
+ */
+ function addLine(childNodes) {
+ var line = dom.createElement('div');
+ line.className = 'code-line';
+ // event/hook: after-line-create
+ line.append.apply(line, childNodes);
+ // event/hook: before-add-line
+ wrapper.append(line);
+ }
+
+ var lineNodes = [];
+
+ // This outer loop will go through all nodes in the DOM in order.
+ // This can be thought of as iterating over all top-level tokens.
+ /** @type {Node | undefined} */
+ var currentNode;
+ while (currentNode = domNodesReversed.pop()) {
+
+ // The inner loop will process the current node. The current node may be split any number of times and the
+ // split result also has to be processed.
+ while (currentNode) {
+ var res = splitNode(currentNode, dom);
+ lineNodes.push(currentNode);
+
+ if (res.newline) {
+ // the returned node contains a newline, so we have to create a new line
+ addLine(lineNodes);
+ lineNodes.length = 0;
+
+ // the node was split and there is still some part of it left to precess
+ currentNode = res.rest;
+
+ } else {
+ // the current node doesn't contain a newline, so we just append it to the current line and
+ // process the next node.
+ break;
}
- if (detached)
- line.appendChild(detached);
- }
- else {
- line.appendChild(currentNode.cloneNode(true));
}
- currentNode = currentNode.nextSibling;
}
- wrapped.appendChild(line);
- if (wrapped.children) {
- env.highlightedCode = '';
- for (i = 0; i < wrapped.children.length; i++)
- env.highlightedCode += wrapped.children[i].outerHTML;
+ if (lineNodes.length > 0) {
+ addLine(lineNodes);
}
+
+ env.highlightedCode = wrapper.innerHTML;
+
+ // event/hook: complete-lines
});
+
}());
diff --git a/plugins/lines/prism-lines.min.js b/plugins/lines/prism-lines.min.js
index ae53757d30..7615ee1bfa 100644
--- a/plugins/lines/prism-lines.min.js
+++ b/plugins/lines/prism-lines.min.js
@@ -1 +1 @@
-"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("before-insert",function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&!t.className.includes("nolines")){var n=1;t.hasAttribute("data-start")&&(n=parseInt(t.getAttribute("data-start"),10),isNaN(n)&&(n=1),t.style.setProperty("--counter-start",n-1));for(var r=(new DOMParser).parseFromString(e.highlightedCode,"text/html"),d=new DocumentFragment,a=n,o=h(a++,t.id),l=r.body.firstChild;l;){if(/\n/.test(l.textContent)){for(var s=l.cloneNode(!0);s&&/\n/.test(s.textContent);){var u=c(s);o.appendChild(u[0]),d.appendChild(o),o=h(a++,t.id),s=u[1]}s&&o.appendChild(s)}else o.appendChild(l.cloneNode(!0));l=l.nextSibling}if(d.appendChild(o),d.children)for(e.highlightedCode="",i=0;i/* a \n',
+ ' b */'
+ ].join(''));
+
+ assert.equal(highlightedMarkup(`var\n/* a \n b */\nbar\n=\n\n0;`, 'javascript'), [
+ 'var\n',
+ '/* a \n',
+ ' b */\n',
+ 'bar\n',
+ '=\n',
+ '\n',
+ '0;'
+ ].join(''));
+
+
+ assert.equal(processMarkup(`foo\nfoofoo\nfoo `, 'javascript'), [
+ 'foo\n',
+ 'foofoo\n ',
+ 'foo '
+ ].join(''));
+ });
+
+ it('- should handle zero-width elements correctly', function () {
+ assert.equal(processMarkup(`\n\n`, 'javascript'), [
+ '',
+ '',
+ ''
+ ].join(''));
+
+ assert.equal(processMarkup(`\n \n\n \n`, 'javascript'), [
+ '\n ',
+ '\n',
+ '\n ',
+ ' \n'
+ ].join(''));
+
+ assert.equal(processMarkup(` `, 'javascript'), [
+ ' '
+ ].join(''));
+ });
+
+ it('- should not create empty last lines', function () {
+ assert.equal(processMarkup(`foo`, 'javascript'), [
+ 'foo'
+ ].join(''));
+
+ assert.equal(processMarkup(`foo\n`, 'javascript'), [
+ 'foo\n'
+ ].join(''));
+
+ assert.equal(processMarkup(`foo\n\n`, 'javascript'), [
+ 'foo\n',
+ '\n'
+ ].join(''));
+
+ // the last line contains spaces and is therefore not empty
+ assert.equal(processMarkup(`foo\n\n `, 'javascript'), [
+ 'foo\n',
+ '\n',
+ ' '
+ ].join(''));
+ });
+
+ it('- should ignore comments', function () {
+ assert.equal(processMarkup(`foobar`, 'javascript'), [
+ 'foobar'
+ ].join(''));
+ });
+
+});
From bf69c5e6412df935ae429cde55a7049920f78f96 Mon Sep 17 00:00:00 2001
From: RunDevelopment
Date: Fri, 29 May 2020 16:48:37 +0200
Subject: [PATCH 09/11] Minor improvements
---
plugins/lines/prism-lines.js | 27 ++++++++++++++++-----------
plugins/lines/prism-lines.min.js | 2 +-
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/plugins/lines/prism-lines.js b/plugins/lines/prism-lines.js
index fb66383e18..fd968900bb 100644
--- a/plugins/lines/prism-lines.js
+++ b/plugins/lines/prism-lines.js
@@ -12,7 +12,7 @@
* @param {Element} element
* @returns {Node[]}
*/
- function clearChildNodes(element) {
+ function drainChildNodes(element) {
/** @type {Node[]} */
var nodes = [];
@@ -62,21 +62,21 @@
* newline.
*
* @param {Node} node
- * @param {Document} document
* @returns {Readonly}
*
* @typedef SplitResult
- * @property {boolean | undefined} [newline] If `newline` is `false`, then `rest` will be `undefined`.
+ * @property {boolean | undefined} [newline] If `newline` is `false` (or undefined), then `rest` will be
+ * `undefined`.
* @property {Node | undefined} [rest]
*/
- function splitNode(node, document) {
+ function splitNode(node) {
switch (node.nodeType) {
case Node.ELEMENT_NODE:
var element = /** @type {Element} */ (node);
for (var i = 0, l = element.childNodes.length; i < l; i++) {
var child = element.childNodes[i];
- var res = splitNode(child, document);
+ var res = splitNode(child);
if (res.newline) {
if (!res.rest && i === l - 1) {
@@ -129,6 +129,8 @@
}
+ var parser = new DOMParser();
+
Prism.hooks.add('before-insert', function (env) {
// works only for wrapped inside (not inline)
@@ -138,8 +140,11 @@
return;
}
- var dom = new DOMParser().parseFromString(env.highlightedCode, 'text/html');
- var domNodesReversed = clearChildNodes(dom.body).reverse();
+ // event/hook: before-lines
+
+ var dom = parser.parseFromString(env.highlightedCode, 'text/html');
+ /** @type {readonly Node[]} */
+ var domNodes = drainChildNodes(dom.body);
var wrapper = dom.createElement('div');
/**
@@ -158,14 +163,14 @@
// This outer loop will go through all nodes in the DOM in order.
// This can be thought of as iterating over all top-level tokens.
- /** @type {Node | undefined} */
- var currentNode;
- while (currentNode = domNodesReversed.pop()) {
+ for (var i = 0, l = domNodes.length; i < l; i++) {
+ /** @type {Node | undefined} */
+ var currentNode = domNodes[i];
// The inner loop will process the current node. The current node may be split any number of times and the
// split result also has to be processed.
while (currentNode) {
- var res = splitNode(currentNode, dom);
+ var res = splitNode(currentNode);
lineNodes.push(currentNode);
if (res.newline) {
diff --git a/plugins/lines/prism-lines.min.js b/plugins/lines/prism-lines.min.js
index 7615ee1bfa..74e8f85166 100644
--- a/plugins/lines/prism-lines.min.js
+++ b/plugins/lines/prism-lines.min.js
@@ -1 +1 @@
-!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var s={},f={newline:!0};Prism.hooks.add("before-insert",function(e){var r=e.element.parentNode;if(r&&/^pre$/i.test(r.nodeName)){for(var n,t=(new DOMParser).parseFromString(e.highlightedCode,"text/html"),i=function(e){for(var r,n=[];r=e.firstChild;)n.push(r),e.removeChild(r);return n}(t.body).reverse(),a=t.createElement("div"),d=[];n=i.pop();)for(;n;){var o=p(n,t);if(d.push(n),!o.newline)break;l(d),d.length=0,n=o.rest}0
Date: Fri, 29 May 2020 16:50:04 +0200
Subject: [PATCH 10/11] Removed CSS
---
components.js | 2 +-
components.json | 3 +-
plugins/lines/prism-lines.css | 89 -----------------------------------
3 files changed, 3 insertions(+), 91 deletions(-)
delete mode 100644 plugins/lines/prism-lines.css
diff --git a/components.js b/components.js
index d0195a6327..8a45e3d774 100644
--- a/components.js
+++ b/components.js
@@ -1,2 +1,2 @@
-var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"Augmented Backus–Naur form","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"Backus–Naur form","alias":"rbnf","aliasTitles":{"rbnf":"Routing Backus–Naur form"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cil":{"title":"CIL","owner":"sbrl"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"clojure":{"title":"Clojure","owner":"troglotit"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dax":{"title":"DAX","owner":"peterbud"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"ebnf":{"title":"Extended Backus–Naur form","owner":"RunDevelopment"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"http":{"title":"HTTP","optional":["css","javascript","json","markup"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mizar":{"title":"Mizar","owner":"Golmote"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nginx":{"title":"nginx","owner":"westonganger","require":"clike"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","markup-templating"],"owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","modify":["actionscript","coffeescript","flow","javascript","typescript","vala"],"owner":"RunDevelopment"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"solidity":{"title":"Solidity (Ethereum)","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"vala":{"title":"Vala","require":"clike","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":"vb","owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"lines":{"title":"Lines","description":"Creates a wrapper element for every line.","owner":"galaxy4public"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}};
+var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"Augmented Backus–Naur form","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"Backus–Naur form","alias":"rbnf","aliasTitles":{"rbnf":"Routing Backus–Naur form"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cil":{"title":"CIL","owner":"sbrl"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"clojure":{"title":"Clojure","owner":"troglotit"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dax":{"title":"DAX","owner":"peterbud"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"ebnf":{"title":"Extended Backus–Naur form","owner":"RunDevelopment"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"http":{"title":"HTTP","optional":["css","javascript","json","markup"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mizar":{"title":"Mizar","owner":"Golmote"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nginx":{"title":"nginx","owner":"westonganger","require":"clike"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","markup-templating"],"owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","modify":["actionscript","coffeescript","flow","javascript","typescript","vala"],"owner":"RunDevelopment"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"solidity":{"title":"Solidity (Ethereum)","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"vala":{"title":"Vala","require":"clike","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":"vb","owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"lines":{"title":"Lines","description":"Creates a wrapper element for every line.","owner":"galaxy4public","noCSS":true},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}};
if (typeof module !== 'undefined' && module.exports) { module.exports = components; }
\ No newline at end of file
diff --git a/components.json b/components.json
index b1832783b6..1f9877b2ae 100644
--- a/components.json
+++ b/components.json
@@ -1194,7 +1194,8 @@
"lines": {
"title": "Lines",
"description": "Creates a wrapper element for every line.",
- "owner": "galaxy4public"
+ "owner": "galaxy4public",
+ "noCSS": true
},
"show-invisibles": {
"title": "Show Invisibles",
diff --git a/plugins/lines/prism-lines.css b/plugins/lines/prism-lines.css
deleted file mode 100644
index d8ecce969d..0000000000
--- a/plugins/lines/prism-lines.css
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Protects from themes that mess the code block up */
-pre[class*="language-"] > code {
- position: relative;
- display: block;
-}
-
-pre[class*="language-"] div.line {
- position: relative;
- display: block;
- height: 100%;
- line-height: inherit;
- text-indent: -1.5em;
- padding-left: 1.5em;
-}
-pre[class*="language-"] div.line::after {
- content: '';
- position: absolute;
- display: block;
- top: 0;
- left: .5em;
- width: 100%;
- height: 100%;
- text-indent: 0;
- background:
- url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDI0IDI0Ij48dGV4dCB4PSIwIiB5PSIxOSI+JiN4MjNjZTs8L3RleHQ+PC9zdmc+Cg==)
- no-repeat repeat;
- background-size: 1.5em 1.5em;
- clip: rect(1.5em 1.5em 100vh 0);
- opacity: .5;
- transform: rotateY(180deg);
- transform-origin: left;
-}
-
-/*** The following sample CSS code is disabled by default in order not to
- * angry lots of people since it kind of taps into other plugins' territory.
- * It is recommended to add the rules in the commented block below to your
- * local to your project CSS rule set and get the benefits described in the
- * plugin documentation.
- ***/
-
-/* Visually backward compatible replacement of the line-numbers plugin :) */
-/*
-.line-numbers pre[class*="language-"],
-pre[class*="language-"].line-numbers {
- counter-reset: linenumber;
- counter-reset: linenumber var(--counter-start,0);
- padding-left: 0;
-}
-
-pre[class*="language-"] > code {
- white-space: inherit;
-}
-
-.line-numbers pre[class*="language-"] > code,
-pre[class*="language-"].line-numbers > code {
- padding-left: 3.8em;
-}
-
-.line-numbers pre[class*="language-"] div.line > a::before,
-pre[class*="language-"].line-numbers div.line > a::before {
- content: counter(linenumber);
- box-sizing: border-box;
- counter-increment: linenumber;
- color: #999;
- text-indent: 0;
- text-align: right;
- left: -3.8em;
- display: block;
- position: absolute;
- width: 3em;
- height: 100%;
- padding-right: .8em;
- border-right: solid #999;
- cursor: default;
- pointer-events: none;
-}
-
-.line-numbers pre[class*="language-"][id] div.line > a::before,
-pre[class*="language-"][id].line-numbers div.line > a::before {
- cursor: pointer;
- pointer-events: auto;
-}
-
-.line-numbers pre[class*="language-"][id] div.line > a:hover::before,
-pre[class*="language-"][id].line-numbers div.line > a:hover::before {
- color: black;
- background: rgba(0,0,0,.1);
-}
-*/
From d628cfaa3c29583d194afc6df1134ff21290c1b8 Mon Sep 17 00:00:00 2001
From: RunDevelopment
Date: Mon, 1 Jun 2020 15:31:04 +0200
Subject: [PATCH 11/11] Added listener and other changes
---
plugins/lines/prism-lines.js | 83 ++++++++++++++++++++++++++++----
plugins/lines/prism-lines.min.js | 2 +-
tests/plugins/lines/test.js | 61 ++++++++++++-----------
3 files changed, 108 insertions(+), 38 deletions(-)
diff --git a/plugins/lines/prism-lines.js b/plugins/lines/prism-lines.js
index fd968900bb..dafa387c2a 100644
--- a/plugins/lines/prism-lines.js
+++ b/plugins/lines/prism-lines.js
@@ -129,18 +129,73 @@
}
+ /**
+ * @typedef RegisterHookEnv
+ * @property {HTMLPreElement} pre
+ * @property {Prism.hooks.HookEnvironmentMap["before-insert"]} env
+ * @property {LinesListener[]} listeners
+ *
+ * @typedef {{ [K in keyof Envs]?: (env: Envs[K]) => void }} LinesListener
+ *
+ * @typedef Envs
+ * @property {BasicLinesEnv} onBefore
+ * @property {BasicLinesEnv & NewLineEnv} onNewLine
+ * @property {BasicLinesEnv & CompleteEnv} onComplete
+ *
+ * @typedef BasicLinesEnv
+ * @property {HTMLPreElement} pre
+ * @property {Prism.hooks.HookEnvironmentMap["before-insert"]} env
+ *
+ * @typedef NewLineEnv
+ * @property {Element} line
+ * @property {Node[]} childNodes
+ *
+ * @typedef CompleteEnv
+ * @property {Node & ParentNode} lines
+ */
+
var parser = new DOMParser();
Prism.hooks.add('before-insert', function (env) {
// works only for wrapped inside (not inline)
- /** @type {HTMLPreElement} */
- var pre = env.element.parentNode;
+ var pre = /** @type {HTMLPreElement} */ (env.element.parentNode);
if (!pre || !/^pre$/i.test(pre.nodeName)) {
return;
}
- // event/hook: before-lines
+ // prepare the registration hook
+ /** @type {LinesListener[]} */
+ var listeners = [];
+ Prism.hooks.run('lines-register', /** @type {RegisterHookEnv} */({
+ pre: pre,
+ env: env,
+ listeners: listeners
+ }));
+
+ if (!listeners.length) {
+ // no plugin needs line wrappers, so we don't add any
+ return;
+ }
+
+ /**
+ * @param {T} event
+ * @param {Envs[T]} env
+ * @template {keyof Envs} T
+ */
+ function fire(event, env) {
+ for (var listener, i = 0; listener = listeners[i++];) {
+ var fn = listener[event];
+ if (fn) {
+ fn(/** @type {any} */(env));
+ }
+ }
+ }
+
+ fire('onBefore', {
+ pre: pre,
+ env: env
+ });
var dom = parser.parseFromString(env.highlightedCode, 'text/html');
/** @type {readonly Node[]} */
@@ -148,14 +203,20 @@
var wrapper = dom.createElement('div');
/**
- * @param {readonly Node[]} childNodes
+ * @param {Node[]} childNodes
*/
function addLine(childNodes) {
var line = dom.createElement('div');
- line.className = 'code-line';
- // event/hook: after-line-create
+ line.className = 'prism-line';
+
+ fire('onNewLine', {
+ pre: pre,
+ env: env,
+ line: line,
+ childNodes: childNodes
+ });
+
line.append.apply(line, childNodes);
- // event/hook: before-add-line
wrapper.append(line);
}
@@ -193,9 +254,13 @@
addLine(lineNodes);
}
- env.highlightedCode = wrapper.innerHTML;
+ fire('onComplete', {
+ pre: pre,
+ env: env,
+ lines: wrapper
+ });
- // event/hook: complete-lines
+ env.highlightedCode = wrapper.innerHTML;
});
}());
diff --git a/plugins/lines/prism-lines.min.js b/plugins/lines/prism-lines.min.js
index 74e8f85166..e54e6c2c0a 100644
--- a/plugins/lines/prism-lines.min.js
+++ b/plugins/lines/prism-lines.min.js
@@ -1 +1 @@
-!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var o={},s={newline:!0},h=new DOMParser;Prism.hooks.add("before-insert",function(e){var n=e.element.parentNode;if(n&&/^pre$/i.test(n.nodeName)){for(var r=h.parseFromString(e.highlightedCode,"text/html"),t=function(e){for(var n,r=[];n=e.firstChild;)r.push(n),e.removeChild(n);return r}(r.body),i=r.createElement("div"),a=[],d=0,l=t.length;d {
+ // register a noop listener to active the Lines plugin
+ env.listeners.push({});
+ });
+
function highlightedMarkup(text, language) {
const pre = document.createElement('pre');
pre.className = `language-${language}`;
@@ -43,72 +48,72 @@ describe('Prism Lines Plugin', function () {
it('- should split lines correctly', function () {
assert.equal(highlightedMarkup(`/* a \n b */`, 'javascript'), [
- '/* a \n',
- ' b */'
+ '/* a \n',
+ ' b */'
].join(''));
assert.equal(highlightedMarkup(`var\n/* a \n b */\nbar\n=\n\n0;`, 'javascript'), [
- 'var\n',
- '/* a \n',
- ' b */\n',
- 'bar\n',
- '=\n',
- '\n',
- '0;'
+ 'var\n',
+ '/* a \n',
+ ' b */\n',
+ 'bar\n',
+ '=\n',
+ '\n',
+ '0;'
].join(''));
assert.equal(processMarkup(`foo\nfoofoo\nfoo `, 'javascript'), [
- 'foo\n',
- 'foofoo\n ',
- 'foo '
+ 'foo\n',
+ 'foofoo\n ',
+ 'foo '
].join(''));
});
it('- should handle zero-width elements correctly', function () {
assert.equal(processMarkup(`\n\n`, 'javascript'), [
- '',
- '',
- ''
+ '',
+ '',
+ ''
].join(''));
assert.equal(processMarkup(`\n \n\n \n`, 'javascript'), [
- '\n ',
- '\n',
- '\n ',
- ' \n'
+ '\n ',
+ '\n',
+ '\n ',
+ ' \n'
].join(''));
assert.equal(processMarkup(` `, 'javascript'), [
- ' '
+ ' '
].join(''));
});
it('- should not create empty last lines', function () {
assert.equal(processMarkup(`foo`, 'javascript'), [
- 'foo'
+ 'foo'
].join(''));
assert.equal(processMarkup(`foo\n`, 'javascript'), [
- 'foo\n'
+ 'foo\n'
].join(''));
assert.equal(processMarkup(`foo\n\n`, 'javascript'), [
- 'foo\n',
- '\n'
+ 'foo\n',
+ '\n'
].join(''));
// the last line contains spaces and is therefore not empty
assert.equal(processMarkup(`foo\n\n `, 'javascript'), [
- 'foo\n',
- '\n',
- ' '
+ 'foo\n',
+ '\n',
+ ' '
].join(''));
});
it('- should ignore comments', function () {
assert.equal(processMarkup(`foobar`, 'javascript'), [
- 'foobar'
+ 'foobar'
].join(''));
});