From 148c1eca2f1a8d76b62c8f11569e959faec59772 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Mon, 6 Sep 2021 20:24:27 +0200 Subject: [PATCH] Added support for Mermaid (#3050) --- components.js | 2 +- components.json | 4 + components/prism-mermaid.js | 113 +++ components/prism-mermaid.min.js | 1 + examples/prism-mermaid.html | 25 + tests/languages/mermaid/arrow_feature.test | 125 +++ tests/languages/mermaid/comment_feature.test | 7 + .../languages/mermaid/full_classdiagram.test | 656 ++++++++++++ tests/languages/mermaid/full_erdiagram.test | 168 ++++ tests/languages/mermaid/full_flowchart.test | 930 ++++++++++++++++++ .../mermaid/full_sequencediagram.test | 389 ++++++++ .../languages/mermaid/full_statediagram.test | 430 ++++++++ .../mermaid/inter-arrow-label_feature.test | 62 ++ tests/languages/mermaid/operator_feature.test | 11 + 14 files changed, 2922 insertions(+), 1 deletion(-) create mode 100644 components/prism-mermaid.js create mode 100644 components/prism-mermaid.min.js create mode 100644 examples/prism-mermaid.html create mode 100644 tests/languages/mermaid/arrow_feature.test create mode 100644 tests/languages/mermaid/comment_feature.test create mode 100644 tests/languages/mermaid/full_classdiagram.test create mode 100644 tests/languages/mermaid/full_erdiagram.test create mode 100644 tests/languages/mermaid/full_flowchart.test create mode 100644 tests/languages/mermaid/full_sequencediagram.test create mode 100644 tests/languages/mermaid/full_statediagram.test create mode 100644 tests/languages/mermaid/inter-arrow-label_feature.test create mode 100644 tests/languages/mermaid/operator_feature.test diff --git a/components.js b/components.js index 239bc3d674..b56c91ce0a 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","optional":"regex","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"ABNF","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"agda":{"title":"Agda","owner":"xy-ren"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apex":{"title":"Apex","require":["clike","sql"],"owner":"RunDevelopment"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"dkern"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"avro-idl":{"title":"Avro IDL","alias":"avdl","owner":"RunDevelopment"},"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"},"bicep":{"title":"Bicep","owner":"johnnyreilly"},"birb":{"title":"Birb","require":"clike","owner":"Calamity210"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"BNF","alias":"rbnf","aliasTitles":{"rbnf":"RBNF"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"bsl":{"title":"BSL (1C:Enterprise)","alias":"oscript","aliasTitles":{"oscript":"OneScript"},"owner":"Diversus23"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cfscript":{"title":"CFScript","require":"clike","alias":"cfc","owner":"mjclemente"},"chaiscript":{"title":"ChaiScript","require":["clike","cpp"],"owner":"RunDevelopment"},"cil":{"title":"CIL","owner":"sbrl"},"clojure":{"title":"Clojure","owner":"troglotit"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"cobol":{"title":"COBOL","owner":"RunDevelopment"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"coq":{"title":"Coq","owner":"RunDevelopment"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"csv":{"title":"CSV","owner":"RunDevelopment"},"cypher":{"title":"Cypher","owner":"RunDevelopment"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dataweave":{"title":"DataWeave","owner":"machaval"},"dax":{"title":"DAX","owner":"peterbud"},"dhall":{"title":"Dhall","owner":"RunDevelopment"},"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"},"dot":{"title":"DOT (Graphviz)","alias":"gv","optional":"markup","owner":"RunDevelopment"},"ebnf":{"title":"EBNF","owner":"RunDevelopment"},"editorconfig":{"title":"EditorConfig","owner":"osipxd"},"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"},"false":{"title":"False","owner":"edukisto"},"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"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"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"},"gn":{"title":"GN","alias":"gni","owner":"RunDevelopment"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","optional":"markdown","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","alias":"hbs","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"},"hoon":{"title":"Hoon","owner":"matildepark"},"http":{"title":"HTTP","optional":["css","javascript","json","markup","uri"],"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"},"icu-message-format":{"title":"ICU Message Format","owner":"RunDevelopment"},"idris":{"title":"Idris","alias":"idr","owner":"KeenS","require":"haskell"},"ignore":{"title":".ignore","owner":"osipxd","alias":["gitignore","hgignore","npmignore"],"aliasTitles":{"gitignore":".gitignore","hgignore":".hgignore","npmignore":".npmignore"}},"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"},"jexl":{"title":"Jexl","owner":"czosel"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike","typescript"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"jsstacktrace":{"title":"JS stack trace","owner":"sbrl"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup","sql"],"owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","alias":["kt","kts"],"aliasTitles":{"kts":"Kotlin Script"},"require":"clike","owner":"Golmote"},"kumir":{"title":"KuMir (КуМир)","alias":"kum","owner":"edukisto"},"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","require":"markup-templating","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"log":{"title":"Log file","optional":"javastacktrace","owner":"RunDevelopment"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","optional":"yaml","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"},"mongodb":{"title":"MongoDB","owner":"airs0urce","require":"javascript"},"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"},"naniscript":{"title":"Naninovel Script","owner":"Elringus","alias":"nani"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nevod":{"title":"Nevod","owner":"nezaboodka"},"nginx":{"title":"nginx","owner":"volado"},"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"},"openqasm":{"title":"OpenQasm","alias":"qasm","owner":"RunDevelopment"},"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"},"psl":{"title":"PATROL Scripting Language","owner":"bertysentry"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":"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"},"promql":{"title":"PromQL","owner":"arendjr"},"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"},"purescript":{"title":"PureScript","require":"haskell","alias":"purs","owner":"sriharshachilakapati"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"qsharp":{"title":"Q#","require":"clike","alias":"qs","owner":"fedonman"},"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"]},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","owner":"RunDevelopment"},"rego":{"title":"Rego","owner":"JordanSh"},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"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","optional":"css-extras","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","alias":["sh-session","shellsession"],"owner":"RunDevelopment"},"smali":{"title":"Smali","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"sml":{"title":"SML","alias":"smlnj","aliasTitles":{"smlnj":"SML/NJ"},"owner":"RunDevelopment"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","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"},"squirrel":{"title":"Squirrel","require":"clike","owner":"RunDevelopment"},"stan":{"title":"Stan","owner":"RunDevelopment"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","owner":"chrischares"},"systemd":{"title":"Systemd configuration file","owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"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"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"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"},"typoscript":{"title":"TypoScript","alias":"tsconfig","aliasTitles":{"tsconfig":"TSConfig"},"owner":"dkern"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"uri":{"title":"URI","alias":"url","aliasTitles":{"url":"URL"},"owner":"RunDevelopment"},"v":{"title":"V","require":"clike","owner":"taggon"},"vala":{"title":"Vala","require":"clike","optional":"regex","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","vba"],"aliasTitles":{"vba":"VBA"},"owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"wolfram":{"title":"Wolfram language","alias":["mathematica","nb","wl"],"aliasTitles":{"mathematica":"Mathematica","nb":"Mathematica Notebook"},"owner":"msollami"},"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"},"yang":{"title":"YANG","owner":"RunDevelopment"},"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"},"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 for fine-grained highlighting.","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","optional":"regex","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"ABNF","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"agda":{"title":"Agda","owner":"xy-ren"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apex":{"title":"Apex","require":["clike","sql"],"owner":"RunDevelopment"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"dkern"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"avro-idl":{"title":"Avro IDL","alias":"avdl","owner":"RunDevelopment"},"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"},"bicep":{"title":"Bicep","owner":"johnnyreilly"},"birb":{"title":"Birb","require":"clike","owner":"Calamity210"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"BNF","alias":"rbnf","aliasTitles":{"rbnf":"RBNF"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"bsl":{"title":"BSL (1C:Enterprise)","alias":"oscript","aliasTitles":{"oscript":"OneScript"},"owner":"Diversus23"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cfscript":{"title":"CFScript","require":"clike","alias":"cfc","owner":"mjclemente"},"chaiscript":{"title":"ChaiScript","require":["clike","cpp"],"owner":"RunDevelopment"},"cil":{"title":"CIL","owner":"sbrl"},"clojure":{"title":"Clojure","owner":"troglotit"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"cobol":{"title":"COBOL","owner":"RunDevelopment"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"coq":{"title":"Coq","owner":"RunDevelopment"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"csv":{"title":"CSV","owner":"RunDevelopment"},"cypher":{"title":"Cypher","owner":"RunDevelopment"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dataweave":{"title":"DataWeave","owner":"machaval"},"dax":{"title":"DAX","owner":"peterbud"},"dhall":{"title":"Dhall","owner":"RunDevelopment"},"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"},"dot":{"title":"DOT (Graphviz)","alias":"gv","optional":"markup","owner":"RunDevelopment"},"ebnf":{"title":"EBNF","owner":"RunDevelopment"},"editorconfig":{"title":"EditorConfig","owner":"osipxd"},"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"},"false":{"title":"False","owner":"edukisto"},"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"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"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"},"gn":{"title":"GN","alias":"gni","owner":"RunDevelopment"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","optional":"markdown","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","alias":"hbs","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"},"hoon":{"title":"Hoon","owner":"matildepark"},"http":{"title":"HTTP","optional":["css","javascript","json","markup","uri"],"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"},"icu-message-format":{"title":"ICU Message Format","owner":"RunDevelopment"},"idris":{"title":"Idris","alias":"idr","owner":"KeenS","require":"haskell"},"ignore":{"title":".ignore","owner":"osipxd","alias":["gitignore","hgignore","npmignore"],"aliasTitles":{"gitignore":".gitignore","hgignore":".hgignore","npmignore":".npmignore"}},"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"},"jexl":{"title":"Jexl","owner":"czosel"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike","typescript"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"jsstacktrace":{"title":"JS stack trace","owner":"sbrl"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup","sql"],"owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","alias":["kt","kts"],"aliasTitles":{"kts":"Kotlin Script"},"require":"clike","owner":"Golmote"},"kumir":{"title":"KuMir (КуМир)","alias":"kum","owner":"edukisto"},"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","require":"markup-templating","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"log":{"title":"Log file","optional":"javastacktrace","owner":"RunDevelopment"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","optional":"yaml","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mermaid":{"title":"Mermaid","owner":"RunDevelopment"},"mizar":{"title":"Mizar","owner":"Golmote"},"mongodb":{"title":"MongoDB","owner":"airs0urce","require":"javascript"},"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"},"naniscript":{"title":"Naninovel Script","owner":"Elringus","alias":"nani"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nevod":{"title":"Nevod","owner":"nezaboodka"},"nginx":{"title":"nginx","owner":"volado"},"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"},"openqasm":{"title":"OpenQasm","alias":"qasm","owner":"RunDevelopment"},"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"},"psl":{"title":"PATROL Scripting Language","owner":"bertysentry"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":"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"},"promql":{"title":"PromQL","owner":"arendjr"},"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"},"purescript":{"title":"PureScript","require":"haskell","alias":"purs","owner":"sriharshachilakapati"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"qsharp":{"title":"Q#","require":"clike","alias":"qs","owner":"fedonman"},"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"]},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","owner":"RunDevelopment"},"rego":{"title":"Rego","owner":"JordanSh"},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"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","optional":"css-extras","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","alias":["sh-session","shellsession"],"owner":"RunDevelopment"},"smali":{"title":"Smali","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"sml":{"title":"SML","alias":"smlnj","aliasTitles":{"smlnj":"SML/NJ"},"owner":"RunDevelopment"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","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"},"squirrel":{"title":"Squirrel","require":"clike","owner":"RunDevelopment"},"stan":{"title":"Stan","owner":"RunDevelopment"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","owner":"chrischares"},"systemd":{"title":"Systemd configuration file","owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"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"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"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"},"typoscript":{"title":"TypoScript","alias":"tsconfig","aliasTitles":{"tsconfig":"TSConfig"},"owner":"dkern"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"uri":{"title":"URI","alias":"url","aliasTitles":{"url":"URL"},"owner":"RunDevelopment"},"v":{"title":"V","require":"clike","owner":"taggon"},"vala":{"title":"Vala","require":"clike","optional":"regex","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","vba"],"aliasTitles":{"vba":"VBA"},"owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"wolfram":{"title":"Wolfram language","alias":["mathematica","nb","wl"],"aliasTitles":{"mathematica":"Mathematica","nb":"Mathematica Notebook"},"owner":"msollami"},"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"},"yang":{"title":"YANG","owner":"RunDevelopment"},"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"},"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 for fine-grained highlighting.","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 2bc9c0e30e..6b17a85f6f 100644 --- a/components.json +++ b/components.json @@ -803,6 +803,10 @@ "title": "MEL", "owner": "Golmote" }, + "mermaid": { + "title": "Mermaid", + "owner": "RunDevelopment" + }, "mizar": { "title": "Mizar", "owner": "Golmote" diff --git a/components/prism-mermaid.js b/components/prism-mermaid.js new file mode 100644 index 0000000000..4950ebf1ae --- /dev/null +++ b/components/prism-mermaid.js @@ -0,0 +1,113 @@ +Prism.languages.mermaid = { + 'comment': { + pattern: /%%.*/, + greedy: true + }, + + 'style': { + pattern: /^([ \t]*(?:classDef|linkStyle|style)[ \t]+[\w$-]+[ \t]+)\w.*[^\s;]/m, + lookbehind: true, + inside: { + 'property': /\b\w[\w-]*(?=[ \t]*:)/, + 'operator': /:/, + 'punctuation': /,/ + } + }, + + 'inter-arrow-label': { + pattern: /([^<>ox.=-])(?:-[-.]|==)(?![<>ox.=-])[ \t]*(?:"[^"\r\n]*"|[^\s".=-](?:[^\r\n.=-]*[^\s.=-])?)[ \t]*(?:\.+->?|--+[->]|==+[=>])(?![<>ox.=-])/, + lookbehind: true, + greedy: true, + inside: { + 'arrow': { + pattern: /(?:\.+->?|--+[->]|==+[=>])$/, + alias: 'operator' + }, + 'label': { + pattern: /^([\s\S]{2}[ \t]*)\S(?:[\s\S]*\S)?/, + lookbehind: true, + alias: 'property' + }, + 'arrow-head': { + pattern: /^\S+/, + alias: ['arrow', 'operator'] + } + } + }, + + 'arrow': [ + // This might look complex but it really isn't. + // There are many possible arrows (see tests) and it's impossible to fit all of them into one pattern. The + // problem is that we only have one lookbehind per pattern. However, we cannot disallow too many arrow + // characters in the one lookbehind because that would create too many false negatives. So we have to split the + // arrows into different patterns. + { + // ER diagram + pattern: /(^|[^{}|o.-])[|}][|o](?:--|\.\.)[|o][|{](?![{}|o.-])/, + lookbehind: true, + alias: 'operator' + }, + { + // flow chart + // (?:==+|--+|-\.*-) + pattern: /(^|[^<>ox.=-])(?:[ox]?|(?:==+|--+|-\.*-)[>ox]|===+|---+|-\.+-)(?![<>ox.=-])/, + lookbehind: true, + alias: 'operator' + }, + { + // sequence diagram + pattern: /(^|[^<>()x-])(?:--?(?:>>|[x>)])(?![<>()x])|(?:<<|[x<(])--?(?!-))/, + lookbehind: true, + alias: 'operator' + }, + { + // class diagram + pattern: /(^|[^<>|*o.-])(?:[*o]--|--[*o]|<\|?(?:--|\.\.)|(?:--|\.\.)\|?>|--|\.\.)(?![<>|*o.-])/, + lookbehind: true, + alias: 'operator' + }, + ], + + 'label': { + pattern: /(^|[^|<])\|(?:[^\r\n"|]|"[^"\r\n]*")+\|/, + lookbehind: true, + greedy: true, + alias: 'property' + }, + + 'text': { + pattern: /(?:[(\[{]+|\b>)(?:[^\r\n"()\[\]{}]|"[^"\r\n]*")+(?:[)\]}]+|>)/, + alias: 'string' + }, + 'string': { + pattern: /"[^"\r\n]*"/, + greedy: true + }, + + 'annotation': { + pattern: /<<(?:abstract|choice|enumeration|fork|interface|join|service)>>|\[\[(?:choice|fork|join)\]\]/i, + alias: 'important' + }, + + 'keyword': [ + // This language has both case-sensitive and case-insensitive keywords + { + pattern: /(^[ \t]*)(?:action|callback|class|classDef|classDiagram|click|direction|erDiagram|flowchart|gantt|gitGraph|graph|journey|link|linkStyle|pie|requirementDiagram|sequenceDiagram|stateDiagram|stateDiagram-v2|style|subgraph)(?![\w$-])/m, + lookbehind: true, + greedy: true + }, + { + pattern: /(^[ \t]*)(?:activate|alt|and|as|autonumber|deactivate|else|end(?:[ \t]+note)?|loop|opt|par|participant|rect|state|note[ \t]+(?:over|(?:left|right)[ \t]+of))(?![\w$-])/im, + lookbehind: true, + greedy: true + } + ], + + 'entity': /#[a-z0-9]+;/, + + 'operator': { + pattern: /(\w[ \t]*)&(?=[ \t]*\w)|:::|:/, + lookbehind: true + }, + 'punctuation': /[(){};]/ +}; diff --git a/components/prism-mermaid.min.js b/components/prism-mermaid.min.js new file mode 100644 index 0000000000..054b4350b0 --- /dev/null +++ b/components/prism-mermaid.min.js @@ -0,0 +1 @@ +Prism.languages.mermaid={comment:{pattern:/%%.*/,greedy:!0},style:{pattern:/^([ \t]*(?:classDef|linkStyle|style)[ \t]+[\w$-]+[ \t]+)\w.*[^\s;]/m,lookbehind:!0,inside:{property:/\b\w[\w-]*(?=[ \t]*:)/,operator:/:/,punctuation:/,/}},"inter-arrow-label":{pattern:/([^<>ox.=-])(?:-[-.]|==)(?![<>ox.=-])[ \t]*(?:"[^"\r\n]*"|[^\s".=-](?:[^\r\n.=-]*[^\s.=-])?)[ \t]*(?:\.+->?|--+[->]|==+[=>])(?![<>ox.=-])/,lookbehind:!0,greedy:!0,inside:{arrow:{pattern:/(?:\.+->?|--+[->]|==+[=>])$/,alias:"operator"},label:{pattern:/^([\s\S]{2}[ \t]*)\S(?:[\s\S]*\S)?/,lookbehind:!0,alias:"property"},"arrow-head":{pattern:/^\S+/,alias:["arrow","operator"]}}},arrow:[{pattern:/(^|[^{}|o.-])[|}][|o](?:--|\.\.)[|o][|{](?![{}|o.-])/,lookbehind:!0,alias:"operator"},{pattern:/(^|[^<>ox.=-])(?:[ox]?|(?:==+|--+|-\.*-)[>ox]|===+|---+|-\.+-)(?![<>ox.=-])/,lookbehind:!0,alias:"operator"},{pattern:/(^|[^<>()x-])(?:--?(?:>>|[x>)])(?![<>()x])|(?:<<|[x<(])--?(?!-))/,lookbehind:!0,alias:"operator"},{pattern:/(^|[^<>|*o.-])(?:[*o]--|--[*o]|<\|?(?:--|\.\.)|(?:--|\.\.)\|?>|--|\.\.)(?![<>|*o.-])/,lookbehind:!0,alias:"operator"}],label:{pattern:/(^|[^|<])\|(?:[^\r\n"|]|"[^"\r\n]*")+\|/,lookbehind:!0,greedy:!0,alias:"property"},text:{pattern:/(?:[(\[{]+|\b>)(?:[^\r\n"()\[\]{}]|"[^"\r\n]*")+(?:[)\]}]+|>)/,alias:"string"},string:{pattern:/"[^"\r\n]*"/,greedy:!0},annotation:{pattern:/<<(?:abstract|choice|enumeration|fork|interface|join|service)>>|\[\[(?:choice|fork|join)\]\]/i,alias:"important"},keyword:[{pattern:/(^[ \t]*)(?:action|callback|class|classDef|classDiagram|click|direction|erDiagram|flowchart|gantt|gitGraph|graph|journey|link|linkStyle|pie|requirementDiagram|sequenceDiagram|stateDiagram|stateDiagram-v2|style|subgraph)(?![\w$-])/m,lookbehind:!0,greedy:!0},{pattern:/(^[ \t]*)(?:activate|alt|and|as|autonumber|deactivate|else|end(?:[ \t]+note)?|loop|opt|par|participant|rect|state|note[ \t]+(?:over|(?:left|right)[ \t]+of))(?![\w$-])/im,lookbehind:!0,greedy:!0}],entity:/#[a-z0-9]+;/,operator:{pattern:/(\w[ \t]*)&(?=[ \t]*\w)|:::|:/,lookbehind:!0},punctuation:/[(){};]/}; \ No newline at end of file diff --git a/examples/prism-mermaid.html b/examples/prism-mermaid.html new file mode 100644 index 0000000000..c379bf27b5 --- /dev/null +++ b/examples/prism-mermaid.html @@ -0,0 +1,25 @@ +

Full example

+
%% https://github.com/mermaid-js/mermaid/blob/develop/docs/examples.md#larger-flowchart-with-some-styling
+
+graph TB
+	sq[Square shape] --> ci((Circle shape))
+
+	subgraph A
+		od>Odd shape]-- Two line<br/>edge comment --> ro
+		di{Diamond with <br/> line break} -.-> ro(Rounded<br>square<br>shape)
+		di==>ro2(Rounded square shape)
+	end
+
+	%% Notice that no text in shape are added here instead that is appended further down
+	e --> od3>Really long text with linebreak<br>in an Odd shape]
+
+	%% Comments after double percent signs
+	e((Inner / circle<br>and some odd <br>special characters)) --> f(,.?!+-*ز)
+
+	cyr[Cyrillic]-->cyr2((Circle shape Начало));
+
+	classDef green fill:#9f6,stroke:#333,stroke-width:2px;
+	classDef orange fill:#f96,stroke:#333,stroke-width:4px;
+	class sq,e green
+	class di orange
+
diff --git a/tests/languages/mermaid/arrow_feature.test b/tests/languages/mermaid/arrow_feature.test new file mode 100644 index 0000000000..6205a313ff --- /dev/null +++ b/tests/languages/mermaid/arrow_feature.test @@ -0,0 +1,125 @@ +%% flow chart + +--- ---- ----- +--> ---> ----> +<-- <--- <---- +=== ==== ===== +==> ===> ====> +<== <=== <==== +-.- -..- -...- +-.-> -..-> -...-> +<-.- <-..- <-...- +--x ---x ----x +--x -.-x -..-x +x-- x--- x---- +x-- x-.- x-..- +--o ---o ----o +--o -.-o -..-o +o-- o--- o---- +o-- o-.- o-..- + +<--> <----> <-..-> <====> +x--x x----x x-..-x x====x +o--o o----o o-..-o o====o + +%% sequence diagram + +-> --> ->> -->> +<- <-- <<- <<-- +-x --x -) --) +x- x-- (- (-- + +%% class diagram + +<|-- *-- o-- <-- <.. <|.. +--|> --* --o --> ..> ..|> +-- .. + +%% ER diagram + +|o--o| |o..o| +||--|| ||..|| +}o--o{ }o..o{ +}|--|{ }|..|{ + +|o--o| |o..o| +||--o{ ||..o{ +}o--|{ }o..|{ +}|--|| }|..|| + +---------------------------------------------------- + +[ + ["comment", "%% flow chart"], + + ["arrow", "---"], ["arrow", "----"], ["arrow", "-----"], + ["arrow", "-->"], ["arrow", "--->"], ["arrow", "---->"], + ["arrow", "<--"], ["arrow", "<---"], ["arrow", "<----"], + ["arrow", "==="], ["arrow", "===="], ["arrow", "====="], + ["arrow", "==>"], ["arrow", "===>"], ["arrow", "====>"], + ["arrow", "<=="], ["arrow", "<==="], ["arrow", "<===="], + ["arrow", "-.-"], ["arrow", "-..-"], ["arrow", "-...-"], + ["arrow", "-.->"], ["arrow", "-..->"], ["arrow", "-...->"], + ["arrow", "<-.-"], ["arrow", "<-..-"], ["arrow", "<-...-"], + ["arrow", "--x"], ["arrow", "---x"], ["arrow", "----x"], + ["arrow", "--x"], ["arrow", "-.-x"], ["arrow", "-..-x"], + ["arrow", "x--"], ["arrow", "x---"], ["arrow", "x----"], + ["arrow", "x--"], ["arrow", "x-.-"], ["arrow", "x-..-"], + ["arrow", "--o"], ["arrow", "---o"], ["arrow", "----o"], + ["arrow", "--o"], ["arrow", "-.-o"], ["arrow", "-..-o"], + ["arrow", "o--"], ["arrow", "o---"], ["arrow", "o----"], + ["arrow", "o--"], ["arrow", "o-.-"], ["arrow", "o-..-"], + + ["arrow", "<-->"], + ["arrow", "<---->"], + ["arrow", "<-..->"], + ["arrow", "<====>"], + + ["arrow", "x--x"], + ["arrow", "x----x"], + ["arrow", "x-..-x"], + ["arrow", "x====x"], + + ["arrow", "o--o"], + ["arrow", "o----o"], + ["arrow", "o-..-o"], + ["arrow", "o====o"], + + ["comment", "%% sequence diagram"], + + ["arrow", "->"], ["arrow", "-->"], ["arrow", "->>"], ["arrow", "-->>"], + ["arrow", "<-"], ["arrow", "<--"], ["arrow", "<<-"], ["arrow", "<<--"], + ["arrow", "-x"], ["arrow", "--x"], ["arrow", "-)"], ["arrow", "--)"], + ["arrow", "x-"], ["arrow", "x--"], ["arrow", "(-"], ["arrow", "(--"], + + ["comment", "%% class diagram"], + + ["arrow", "<|--"], + ["arrow", "*--"], + ["arrow", "o--"], + ["arrow", "<--"], + ["arrow", "<.."], + ["arrow", "<|.."], + + ["arrow", "--|>"], + ["arrow", "--*"], + ["arrow", "--o"], + ["arrow", "-->"], + ["arrow", "..>"], + ["arrow", "..|>"], + + ["arrow", "--"], + ["arrow", ".."], + + ["comment", "%% ER diagram"], + + ["arrow", "|o--o|"], ["arrow", "|o..o|"], + ["arrow", "||--||"], ["arrow", "||..||"], + ["arrow", "}o--o{"], ["arrow", "}o..o{"], + ["arrow", "}|--|{"], ["arrow", "}|..|{"], + + ["arrow", "|o--o|"], ["arrow", "|o..o|"], + ["arrow", "||--o{"], ["arrow", "||..o{"], + ["arrow", "}o--|{"], ["arrow", "}o..|{"], + ["arrow", "}|--||"], ["arrow", "}|..||"] +] diff --git a/tests/languages/mermaid/comment_feature.test b/tests/languages/mermaid/comment_feature.test new file mode 100644 index 0000000000..90b8493fba --- /dev/null +++ b/tests/languages/mermaid/comment_feature.test @@ -0,0 +1,7 @@ +%% comment + +---------------------------------------------------- + +[ + ["comment", "%% comment"] +] diff --git a/tests/languages/mermaid/full_classdiagram.test b/tests/languages/mermaid/full_classdiagram.test new file mode 100644 index 0000000000..e612373f67 --- /dev/null +++ b/tests/languages/mermaid/full_classdiagram.test @@ -0,0 +1,656 @@ +classDiagram + Animal <|-- Duck + Animal <|-- Fish + Animal <|-- Zebra + Animal : +int age + Animal : +String gender + Animal: +isMammal() + Animal: +mate() + class Duck{ + +String beakColor + +swim() + +quack() + } + class Fish{ + -int sizeInFeet + -canEat() + } + class Zebra{ + +bool is_wild + +run() + } + +classDiagram + class BankAccount + BankAccount : +String owner + BankAccount : +Bigdecimal balance + BankAccount : +deposit(amount) + BankAccount : +withdrawl(amount) + +classDiagram + class Animal + Vehicle <|-- Car + +class BankAccount + BankAccount : +String owner + BankAccount : +BigDecimal balance + BankAccount : +deposit(amount) + BankAccount : +withdrawal(amount) + +class BankAccount{ + +String owner + +BigDecimal balance + +deposit(amount) + +withdrawl(amount) +} + +class BankAccount{ + +String owner + +BigDecimal balance + +deposit(amount) bool + +withdrawl(amount) int +} + +classDiagram +class Square~Shape~{ + int id + List~int~ position + setPoints(List~int~ points) + getPoints() List~int~ +} + +Square : -List~string~ messages +Square : +setMessages(List~string~ messages) +Square : +getMessages() List~string~ + +classDiagram +classA <|-- classB +classC *-- classD +classE o-- classF +classG <-- classH +classI -- classJ +classK <.. classL +classM <|.. classN +classO .. classP + +classDiagram +classA --|> classB : Inheritance +classC --* classD : Composition +classE --o classF : Aggregation +classG --> classH : Association +classI -- classJ : Link(Solid) +classK ..> classL : Dependency +classM ..|> classN : Realization +classO .. classP : Link(Dashed) + +classDiagram +classA <|-- classB : implements +classC *-- classD : composition +classE o-- classF : association + +classDiagram + Customer "1" --> "*" Ticket + Student "1" --> "1..*" Course + Galaxy --> "many" Star : Contains + +classDiagram +class Shape +<> Shape + +classDiagram +class Shape{ + <> + noOfVertices + draw() +} +class Color{ + <> + RED + BLUE + GREEN + WHITE + BLACK +} + +classDiagram +%% This whole line is a comment classDiagram class Shape <> +class Shape{ + <> + noOfVertices + draw() +} + +classDiagram + direction RL + class Student { + -idCard : IdCard + } + class IdCard{ + -id : int + -name : string + } + class Bike{ + -id : int + -name : string + } + Student "1" --o "1" IdCard : carries + Student "1" --o "1" Bike : rides + +action className "reference" "tooltip" +click className call callback() "tooltip" +click className href "url" "tooltip" + +classDiagram +class Shape +link Shape "http://www.github.com" "This is a tooltip for a link" +class Shape2 +click Shape2 href "http://www.github.com" "This is a tooltip for a link" + +classDiagram +class Shape +callback Shape "callbackFunction" "This is a tooltip for a callback" +class Shape2 +click Shape2 call callbackFunction() "This is a tooltip for a callback" + +classDiagram +Animal <|-- Duck +Animal <|-- Fish +Animal <|-- Zebra +Animal : +int age +Animal : +String gender +Animal: +isMammal() +Animal: +mate() +class Duck{ + +String beakColor + +swim() + +quack() + } +class Fish{ + -int sizeInFeet + -canEat() + } +class Zebra{ + +bool is_wild + +run() + } + + callback Duck callback "Tooltip" + link Zebra "http://www.github.com" "This is a link" + +classDiagram + class Animal:::cssClass + +classDiagram + class Animal:::cssClass { + -int sizeInFeet + -canEat() + } + +---------------------------------------------------- + +[ + ["keyword", "classDiagram"], + + "\r\n Animal ", + ["arrow", "<|--"], + " Duck\r\n Animal ", + ["arrow", "<|--"], + " Fish\r\n Animal ", + ["arrow", "<|--"], + " Zebra\r\n Animal ", + ["operator", ":"], + " +int age\r\n Animal ", + ["operator", ":"], + " +String gender\r\n Animal", + ["operator", ":"], + " +isMammal", + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n Animal", + ["operator", ":"], + " +mate", + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "class"], + " Duck", + ["punctuation", "{"], + + "\r\n +String beakColor\r\n +swim", + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n +quack", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "class"], + " Fish", + ["punctuation", "{"], + + "\r\n -int sizeInFeet\r\n -canEat", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "class"], + " Zebra", + ["punctuation", "{"], + + "\r\n +bool is_wild\r\n +run", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " BankAccount\r\n BankAccount ", + ["operator", ":"], + " +String owner\r\n BankAccount ", + ["operator", ":"], + " +Bigdecimal balance\r\n BankAccount ", + ["operator", ":"], + " +deposit", + ["text", "(amount)"], + + "\r\n BankAccount ", + ["operator", ":"], + " +withdrawl", + ["text", "(amount)"], + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " Animal\r\n Vehicle ", + ["arrow", "<|--"], + " Car\r\n\r\n", + + ["keyword", "class"], + " BankAccount\r\n BankAccount ", + ["operator", ":"], + " +String owner\r\n BankAccount ", + ["operator", ":"], + " +BigDecimal balance\r\n BankAccount ", + ["operator", ":"], + " +deposit", + ["text", "(amount)"], + + "\r\n BankAccount ", + ["operator", ":"], + " +withdrawal", + ["text", "(amount)"], + + ["keyword", "class"], + " BankAccount", + ["punctuation", "{"], + + "\r\n +String owner\r\n +BigDecimal balance\r\n +deposit", + ["text", "(amount)"], + + "\r\n +withdrawl", + ["text", "(amount)"], + + ["punctuation", "}"], + + ["keyword", "class"], + " BankAccount", + ["punctuation", "{"], + + "\r\n +String owner\r\n +BigDecimal balance\r\n +deposit", + ["text", "(amount)"], + " bool\r\n +withdrawl", + ["text", "(amount)"], + " int\r\n", + + ["punctuation", "}"], + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " Square~Shape~", + ["punctuation", "{"], + + "\r\n int id\r\n List~int~ position\r\n setPoints", + ["text", "(List~int~ points)"], + + "\r\n getPoints", + ["punctuation", "("], + ["punctuation", ")"], + " List~int~\r\n", + + ["punctuation", "}"], + + "\r\n\r\nSquare ", + ["operator", ":"], + " -List~string~ messages\r\nSquare ", + ["operator", ":"], + " +setMessages", + ["text", "(List~string~ messages)"], + + "\r\nSquare ", + ["operator", ":"], + " +getMessages", + ["punctuation", "("], + ["punctuation", ")"], + " List~string~\r\n\r\n", + + ["keyword", "classDiagram"], + + "\r\nclassA ", + ["arrow", "<|--"], + " classB\r\nclassC ", + ["arrow", "*--"], + " classD\r\nclassE ", + ["arrow", "o--"], + " classF\r\nclassG ", + ["arrow", "<--"], + " classH\r\nclassI ", + ["arrow", "--"], + " classJ\r\nclassK ", + ["arrow", "<.."], + " classL\r\nclassM ", + ["arrow", "<|.."], + " classN\r\nclassO ", + ["arrow", ".."], + " classP\r\n\r\n", + + ["keyword", "classDiagram"], + + "\r\nclassA ", + ["arrow", "--|>"], + " classB ", + ["operator", ":"], + " Inheritance\r\nclassC ", + ["arrow", "--*"], + " classD ", + ["operator", ":"], + " Composition\r\nclassE ", + ["arrow", "--o"], + " classF ", + ["operator", ":"], + " Aggregation\r\nclassG ", + ["arrow", "-->"], + " classH ", + ["operator", ":"], + " Association\r\nclassI ", + ["arrow", "--"], + " classJ ", + ["operator", ":"], + " Link", + ["text", "(Solid)"], + + "\r\nclassK ", + ["arrow", "..>"], + " classL ", + ["operator", ":"], + " Dependency\r\nclassM ", + ["arrow", "..|>"], + " classN ", + ["operator", ":"], + " Realization\r\nclassO ", + ["arrow", ".."], + " classP ", + ["operator", ":"], + " Link", + ["text", "(Dashed)"], + + ["keyword", "classDiagram"], + + "\r\nclassA ", + ["arrow", "<|--"], + " classB ", + ["operator", ":"], + " implements\r\nclassC ", + ["arrow", "*--"], + " classD ", + ["operator", ":"], + " composition\r\nclassE ", + ["arrow", "o--"], + " classF ", + ["operator", ":"], + " association\r\n\r\n", + + ["keyword", "classDiagram"], + + "\r\n Customer ", + ["string", "\"1\""], + ["arrow", "-->"], + ["string", "\"*\""], + " Ticket\r\n Student ", + ["string", "\"1\""], + ["arrow", "-->"], + ["string", "\"1..*\""], + " Course\r\n Galaxy ", + ["arrow", "-->"], + ["string", "\"many\""], + " Star ", + ["operator", ":"], + " Contains\r\n\r\n", + + ["keyword", "classDiagram"], + ["keyword", "class"], " Shape\r\n", + ["annotation", "<>"], " Shape\r\n\r\n", + + ["keyword", "classDiagram"], + ["keyword", "class"], + " Shape", + ["punctuation", "{"], + ["annotation", "<>"], + "\r\n noOfVertices\r\n draw", + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "}"], + ["keyword", "class"], + " Color", + ["punctuation", "{"], + ["annotation", "<>"], + "\r\n RED\r\n BLUE\r\n GREEN\r\n WHITE\r\n BLACK\r\n", + ["punctuation", "}"], + + ["keyword", "classDiagram"], + ["comment", "%% This whole line is a comment classDiagram class Shape <>"], + ["keyword", "class"], + " Shape", + ["punctuation", "{"], + ["annotation", "<>"], + "\r\n noOfVertices\r\n draw", + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "}"], + + ["keyword", "classDiagram"], + + ["keyword", "direction"], + " RL\r\n ", + + ["keyword", "class"], + " Student ", + ["punctuation", "{"], + + "\r\n -idCard ", + ["operator", ":"], + " IdCard\r\n ", + + ["punctuation", "}"], + + ["keyword", "class"], + " IdCard", + ["punctuation", "{"], + + "\r\n -id ", + ["operator", ":"], + " int\r\n -name ", + ["operator", ":"], + " string\r\n ", + + ["punctuation", "}"], + + ["keyword", "class"], + " Bike", + ["punctuation", "{"], + + "\r\n -id ", + ["operator", ":"], + " int\r\n -name ", + ["operator", ":"], + " string\r\n ", + + ["punctuation", "}"], + + "\r\n Student ", + ["string", "\"1\""], + ["arrow", "--o"], + ["string", "\"1\""], + " IdCard ", + ["operator", ":"], + " carries\r\n Student ", + ["string", "\"1\""], + ["arrow", "--o"], + ["string", "\"1\""], + " Bike ", + ["operator", ":"], + " rides\r\n\r\n", + + ["keyword", "action"], + " className ", + ["string", "\"reference\""], + ["string", "\"tooltip\""], + + ["keyword", "click"], + " className call callback", + ["punctuation", "("], + ["punctuation", ")"], + ["string", "\"tooltip\""], + + ["keyword", "click"], + " className href ", + ["string", "\"url\""], + ["string", "\"tooltip\""], + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " Shape\r\n", + + ["keyword", "link"], + " Shape ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a tooltip for a link\""], + + ["keyword", "class"], + " Shape2\r\n", + + ["keyword", "click"], + " Shape2 href ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a tooltip for a link\""], + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " Shape\r\n", + + ["keyword", "callback"], + " Shape ", + ["string", "\"callbackFunction\""], + ["string", "\"This is a tooltip for a callback\""], + + ["keyword", "class"], + " Shape2\r\n", + + ["keyword", "click"], + " Shape2 call callbackFunction", + ["punctuation", "("], + ["punctuation", ")"], + ["string", "\"This is a tooltip for a callback\""], + + ["keyword", "classDiagram"], + + "\r\nAnimal ", + ["arrow", "<|--"], + " Duck\r\nAnimal ", + ["arrow", "<|--"], + " Fish\r\nAnimal ", + ["arrow", "<|--"], + " Zebra\r\nAnimal ", + ["operator", ":"], + " +int age\r\nAnimal ", + ["operator", ":"], + " +String gender\r\nAnimal", + ["operator", ":"], + " +isMammal", + ["punctuation", "("], + ["punctuation", ")"], + + "\r\nAnimal", + ["operator", ":"], + " +mate", + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "class"], + " Duck", + ["punctuation", "{"], + + "\r\n +String beakColor\r\n +swim", + ["punctuation", "("], + ["punctuation", ")"], + + "\r\n +quack", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "class"], + " Fish", + ["punctuation", "{"], + + "\r\n -int sizeInFeet\r\n -canEat", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "class"], + " Zebra", + ["punctuation", "{"], + + "\r\n +bool is_wild\r\n +run", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "callback"], + " Duck callback ", + ["string", "\"Tooltip\""], + + ["keyword", "link"], + " Zebra ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a link\""], + + ["keyword", "classDiagram"], + ["keyword", "class"], " Animal", ["operator", ":::"], "cssClass\r\n\r\n", + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " Animal", + ["operator", ":::"], + "cssClass ", + ["punctuation", "{"], + + "\r\n -int sizeInFeet\r\n -canEat", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"] +] diff --git a/tests/languages/mermaid/full_erdiagram.test b/tests/languages/mermaid/full_erdiagram.test new file mode 100644 index 0000000000..c88f2d46c6 --- /dev/null +++ b/tests/languages/mermaid/full_erdiagram.test @@ -0,0 +1,168 @@ +erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + CUSTOMER }|..|{ DELIVERY-ADDRESS : uses + +erDiagram + CUSTOMER ||--o{ ORDER : places + CUSTOMER { + string name + string custNumber + string sector + } + ORDER ||--|{ LINE-ITEM : contains + ORDER { + int orderNumber + string deliveryAddress + } + LINE-ITEM { + string productCode + int quantity + float pricePerUnit + } + +PROPERTY ||--|{ ROOM : contains + +CAR ||--o{ NAMED-DRIVER : allows + PERSON ||--o{ NAMED-DRIVER : is + +erDiagram + CAR ||--o{ NAMED-DRIVER : allows + CAR { + string registrationNumber + string make + string model + } + PERSON ||--o{ NAMED-DRIVER : is + PERSON { + string firstName + string lastName + int age + } + +erDiagram + CAR ||--o{ NAMED-DRIVER : allows + CAR { + string registrationNumber + string make + string model + } + PERSON ||--o{ NAMED-DRIVER : is + PERSON { + string firstName + string lastName + int age + } + +---------------------------------------------------- + +[ + ["keyword", "erDiagram"], + + "\r\n CUSTOMER ", + ["arrow", "||--o{"], + " ORDER ", + ["operator", ":"], + " places\r\n ORDER ", + ["arrow", "||--|{"], + " LINE-ITEM ", + ["operator", ":"], + " contains\r\n CUSTOMER ", + ["arrow", "}|..|{"], + " DELIVERY-ADDRESS ", + ["operator", ":"], + " uses\r\n\r\n", + + ["keyword", "erDiagram"], + + "\r\n CUSTOMER ", + ["arrow", "||--o{"], + " ORDER ", + ["operator", ":"], + " places\r\n CUSTOMER ", + ["punctuation", "{"], + + "\r\n string name\r\n string custNumber\r\n string sector\r\n ", + + ["punctuation", "}"], + + "\r\n ORDER ", + ["arrow", "||--|{"], + " LINE-ITEM ", + ["operator", ":"], + " contains\r\n ORDER ", + ["punctuation", "{"], + + "\r\n int orderNumber\r\n string deliveryAddress\r\n ", + + ["punctuation", "}"], + + "\r\n LINE-ITEM ", + ["punctuation", "{"], + + "\r\n string productCode\r\n int quantity\r\n float pricePerUnit\r\n ", + + ["punctuation", "}"], + + "\r\n\r\nPROPERTY ", + ["arrow", "||--|{"], + " ROOM ", + ["operator", ":"], + " contains\r\n\r\nCAR ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " allows\r\n PERSON ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " is\r\n\r\n", + + ["keyword", "erDiagram"], + + "\r\n CAR ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " allows\r\n CAR ", + ["punctuation", "{"], + + "\r\n string registrationNumber\r\n string make\r\n string model\r\n ", + + ["punctuation", "}"], + + "\r\n PERSON ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " is\r\n PERSON ", + ["punctuation", "{"], + + "\r\n string firstName\r\n string lastName\r\n int age\r\n ", + + ["punctuation", "}"], + + ["keyword", "erDiagram"], + + "\r\n CAR ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " allows\r\n CAR ", + ["punctuation", "{"], + + "\r\n string registrationNumber\r\n string make\r\n string model\r\n ", + + ["punctuation", "}"], + + "\r\n PERSON ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " is\r\n PERSON ", + ["punctuation", "{"], + + "\r\n string firstName\r\n string lastName\r\n int age\r\n ", + + ["punctuation", "}"] +] diff --git a/tests/languages/mermaid/full_flowchart.test b/tests/languages/mermaid/full_flowchart.test new file mode 100644 index 0000000000..948af017cb --- /dev/null +++ b/tests/languages/mermaid/full_flowchart.test @@ -0,0 +1,930 @@ +flowchart LR + id + +flowchart LR + id1[This is the text in the box] + +flowchart TD + Start --> Stop + +flowchart LR + Start --> Stop + +flowchart LR + id1(This is the text in the box) + +flowchart LR + id1([This is the text in the box]) + +flowchart LR + id1[[This is the text in the box]] + +flowchart LR + id1[(Database)] + +flowchart LR + id1((This is the text in the circle)) + +flowchart LR + id1>This is the text in the box] + +flowchart LR + id1{This is the text in the box} + +flowchart LR + id1{{This is the text in the box}} + +flowchart TD + id1[/This is the text in the box/] + +flowchart TD + id1[\This is the text in the box\] + +flowchart TD + A[/Christmas\] + +flowchart TD + B[\Go shopping/] + +flowchart LR + A-->B + +flowchart LR + A --- B + +flowchart LR + A-- This is the text! ---B + +flowchart LR + A---|This is the text|B + +flowchart LR + A-->|text|B + +flowchart LR + A-- text -->B + +flowchart LR; + A-.->B; + +flowchart LR + A-. text .-> B + +flowchart LR + A ==> B + +flowchart LR + A == text ==> B + +flowchart LR + A -- text --> B -- text2 --> C + +flowchart LR + a --> b & c--> d + +flowchart TB + A & B--> C & D + +flowchart TB + A --> C + A --> D + B --> C + B --> D + +flowchart LR + A --o B + B --x C + +flowchart LR + A o--o B + B <--> C + C x--x D + +flowchart TD + A[Start] --> B{Is it?}; + B -->|Yes| C[OK]; + C --> D[Rethink]; + D --> B; + B ---->|No| E[End]; + +flowchart TD + A[Start] --> B{Is it?}; + B -- Yes --> C[OK]; + C --> D[Rethink]; + D --> B; + B -- No ----> E[End]; + +flowchart LR + id1["This is the (text) in the box"] + +flowchart LR + A["A double quote:#quot;"] -->B["A dec char:#9829;"] + +subgraph title + graph definition +end + +flowchart TB + c1-->a2 + subgraph one + a1-->a2 + end + subgraph two + b1-->b2 + end + subgraph three + c1-->c2 + end + +flowchart TB + c1-->a2 + subgraph ide1 [one] + a1-->a2 + end + +flowchart TB + c1-->a2 + subgraph one + a1-->a2 + end + subgraph two + b1-->b2 + end + subgraph three + c1-->c2 + end + one --> two + three --> two + two --> c2 + +flowchart LR + subgraph TOP + direction TB + subgraph B1 + direction RL + i1 -->f1 + end + subgraph B2 + direction BT + i2 -->f2 + end + end + A --> TOP --> B + B1 --> B2 + +click nodeId callback +click nodeId call callback() + +flowchart LR; + A-->B; + B-->C; + C-->D; + click A callback "Tooltip for a callback" + click B "http://www.github.com" "This is a tooltip for a link" + click A call callback() "Tooltip for a callback" + click B href "http://www.github.com" "This is a tooltip for a link" + +flowchart LR; + A-->B; + B-->C; + C-->D; + D-->E; + click A "http://www.github.com" _blank + click B "http://www.github.com" "Open this in a new tab" _blank + click C href "http://www.github.com" _blank + click D href "http://www.github.com" "Open this in a new tab" _blank + +flowchart LR +%% this is a comment A -- text --> B{node} + A -- text --> B -- text2 --> C + +linkStyle 3 stroke:#ff3,stroke-width:4px,color:red; + +flowchart LR + id1(Start)-->id2(Stop) + style id1 fill:#f9f,stroke:#333,stroke-width:4px + style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5 + +classDef className fill:#f9f,stroke:#333,stroke-width:4px; + +class nodeId1 className; + +class nodeId1,nodeId2 className; + +flowchart LR + A:::someclass --> B + classDef someclass fill:#f96; + +flowchart LR; + A-->B[AAABBB]; + B-->D; + class A cssClass; + +classDef default fill:#f9f,stroke:#333,stroke-width:4px; + +flowchart TD + B["fa:fa-twitter for peace"] + B-->C[fa:fa-ban forbidden] + B-->D(fa:fa-spinner); + B-->E(A fa:fa-camera-retro perhaps?); + +flowchart LR + A[Hard edge] -->|Link text| B(Round edge) + B --> C{Decision} + C -->|One| D[Result one] + C -->|Two| E[Result two] + + flowchart LR; + A-->B; + B-->C; + C-->D; + click A callback "Tooltip" + click B "http://www.github.com" "This is a link" + click C call callback() "Tooltip" + click D href "http://www.github.com" "This is a link" + +---------------------------------------------------- + +[ + ["keyword", "flowchart"], " LR\r\n id\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n id1", + ["text", "[This is the text in the box]"], + + ["keyword", "flowchart"], + " TD\r\n Start ", + ["arrow", "-->"], + " Stop\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n Start ", + ["arrow", "-->"], + " Stop\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n id1", + ["text", "(This is the text in the box)"], + + ["keyword", "flowchart"], + " LR\r\n id1", + ["text", "([This is the text in the box])"], + + ["keyword", "flowchart"], + " LR\r\n id1", + ["text", "[[This is the text in the box]]"], + + ["keyword", "flowchart"], " LR\r\n id1", ["text", "[(Database)]"], + + ["keyword", "flowchart"], + " LR\r\n id1", + ["text", "((This is the text in the circle))"], + + ["keyword", "flowchart"], + " LR\r\n id1", + ["text", ">This is the text in the box]"], + + ["keyword", "flowchart"], + " LR\r\n id1", + ["text", "{This is the text in the box}"], + + ["keyword", "flowchart"], + " LR\r\n id1", + ["text", "{{This is the text in the box}}"], + + ["keyword", "flowchart"], + " TD\r\n id1", + ["text", "[/This is the text in the box/]"], + + ["keyword", "flowchart"], + " TD\r\n id1", + ["text", "[\\This is the text in the box\\]"], + + ["keyword", "flowchart"], " TD\r\n A", ["text", "[/Christmas\\]"], + + ["keyword", "flowchart"], " TD\r\n B", ["text", "[\\Go shopping/]"], + + ["keyword", "flowchart"], " LR\r\n A", ["arrow", "-->"], "B\r\n\r\n", + + ["keyword", "flowchart"], " LR\r\n A ", ["arrow", "---"], " B\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n A", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "This is the text!"], + ["arrow", "---"] + ]], + "B\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n A", + ["arrow", "---"], + ["label", "|This is the text|"], + "B\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n A", + ["arrow", "-->"], + ["label", "|text|"], + "B\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n A", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "text"], + ["arrow", "-->"] + ]], + "B\r\n\r\n", + + ["keyword", "flowchart"], " LR", ["punctuation", ";"], + "\r\n A", ["arrow", "-.->"], "B", ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR\r\n A", + ["inter-arrow-label", [ + ["arrow-head", "-."], + ["label", "text"], + ["arrow", ".->"] + ]], + " B\r\n\r\n", + + ["keyword", "flowchart"], " LR\r\n A ", ["arrow", "==>"], " B\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n A ", + ["inter-arrow-label", [ + ["arrow-head", "=="], + ["label", "text"], + ["arrow", "==>"] + ]], + " B\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n A ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "text"], + ["arrow", "-->"] + ]], + " B ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "text2"], + ["arrow", "-->"] + ]], + " C\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n a ", + ["arrow", "-->"], + " b ", + ["operator", "&"], + " c", + ["arrow", "-->"], + " d\r\n\r\n", + + ["keyword", "flowchart"], + " TB\r\n A ", + ["operator", "&"], + " B", + ["arrow", "-->"], + " C ", + ["operator", "&"], + " D\r\n\r\n", + + ["keyword", "flowchart"], + " TB\r\n A ", + ["arrow", "-->"], + " C\r\n A ", + ["arrow", "-->"], + " D\r\n B ", + ["arrow", "-->"], + " C\r\n B ", + ["arrow", "-->"], + " D\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n A ", + ["arrow", "--o"], + " B\r\n B ", + ["arrow", "--x"], + " C\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n A ", + ["arrow", "o--o"], + " B\r\n B ", + ["arrow", "<-->"], + " C\r\n C ", + ["arrow", "x--x"], + " D\r\n\r\n", + + ["keyword", "flowchart"], + " TD\r\n A", + ["text", "[Start]"], + ["arrow", "-->"], + " B", + ["text", "{Is it?}"], + ["punctuation", ";"], + + "\r\n B ", + ["arrow", "-->"], + ["label", "|Yes|"], + " C", + ["text", "[OK]"], + ["punctuation", ";"], + + "\r\n C ", + ["arrow", "-->"], + " D", + ["text", "[Rethink]"], + ["punctuation", ";"], + + "\r\n D ", + ["arrow", "-->"], + " B", + ["punctuation", ";"], + + "\r\n B ", + ["arrow", "---->"], + ["label", "|No|"], + " E", + ["text", "[End]"], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " TD\r\n A", + ["text", "[Start]"], + ["arrow", "-->"], + " B", + ["text", "{Is it?}"], + ["punctuation", ";"], + + "\r\n B ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "Yes"], + ["arrow", "-->"] + ]], + " C", + ["text", "[OK]"], + ["punctuation", ";"], + + "\r\n C ", + ["arrow", "-->"], + " D", + ["text", "[Rethink]"], + ["punctuation", ";"], + + "\r\n D ", + ["arrow", "-->"], + " B", + ["punctuation", ";"], + + "\r\n B ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "No"], + ["arrow", "---->"] + ]], + " E", + ["text", "[End]"], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR\r\n id1", + ["text", "[\"This is the (text) in the box\"]"], + + ["keyword", "flowchart"], + " LR\r\n A", + ["text", "[\"A double quote:#quot;\"]"], + ["arrow", "-->"], + "B", + ["text", "[\"A dec char:#9829;\"]"], + + ["keyword", "subgraph"], " title\r\n ", + ["keyword", "graph"], " definition\r\n", + ["keyword", "end"], + + ["keyword", "flowchart"], " TB\r\n c1", ["arrow", "-->"], "a2\r\n ", + ["keyword", "subgraph"], " one\r\n a1", ["arrow", "-->"], "a2\r\n ", + ["keyword", "end"], + ["keyword", "subgraph"], " two\r\n b1", ["arrow", "-->"], "b2\r\n ", + ["keyword", "end"], + ["keyword", "subgraph"], " three\r\n c1", ["arrow", "-->"], "c2\r\n ", + ["keyword", "end"], + + ["keyword", "flowchart"], " TB\r\n c1", ["arrow", "-->"], "a2\r\n ", + ["keyword", "subgraph"], " ide1 ", ["text", "[one]"], + "\r\n a1", ["arrow", "-->"], "a2\r\n ", + ["keyword", "end"], + + ["keyword", "flowchart"], + " TB\r\n c1", + ["arrow", "-->"], + "a2\r\n ", + + ["keyword", "subgraph"], + " one\r\n a1", + ["arrow", "-->"], + "a2\r\n ", + + ["keyword", "end"], + + ["keyword", "subgraph"], + " two\r\n b1", + ["arrow", "-->"], + "b2\r\n ", + + ["keyword", "end"], + + ["keyword", "subgraph"], + " three\r\n c1", + ["arrow", "-->"], + "c2\r\n ", + + ["keyword", "end"], + + "\r\n one ", + ["arrow", "-->"], + " two\r\n three ", + ["arrow", "-->"], + " two\r\n two ", + ["arrow", "-->"], + " c2\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n ", + + ["keyword", "subgraph"], + " TOP\r\n ", + + ["keyword", "direction"], + " TB\r\n ", + + ["keyword", "subgraph"], + " B1\r\n ", + + ["keyword", "direction"], + " RL\r\n i1 ", + ["arrow", "-->"], + "f1\r\n ", + + ["keyword", "end"], + + ["keyword", "subgraph"], + " B2\r\n ", + + ["keyword", "direction"], + " BT\r\n i2 ", + ["arrow", "-->"], + "f2\r\n ", + + ["keyword", "end"], + + ["keyword", "end"], + + "\r\n A ", + ["arrow", "-->"], + " TOP ", + ["arrow", "-->"], + " B\r\n B1 ", + ["arrow", "-->"], + " B2\r\n\r\n", + + ["keyword", "click"], + " nodeId callback\r\n", + + ["keyword", "click"], + " nodeId call callback", + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "flowchart"], + " LR", + ["punctuation", ";"], + + "\r\n A", + ["arrow", "-->"], + "B", + ["punctuation", ";"], + + "\r\n B", + ["arrow", "-->"], + "C", + ["punctuation", ";"], + + "\r\n C", + ["arrow", "-->"], + "D", + ["punctuation", ";"], + + ["keyword", "click"], + " A callback ", + ["string", "\"Tooltip for a callback\""], + + ["keyword", "click"], + " B ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a tooltip for a link\""], + + ["keyword", "click"], + " A call callback", + ["punctuation", "("], + ["punctuation", ")"], + ["string", "\"Tooltip for a callback\""], + + ["keyword", "click"], + " B href ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a tooltip for a link\""], + + ["keyword", "flowchart"], + " LR", + ["punctuation", ";"], + + "\r\n A", + ["arrow", "-->"], + "B", + ["punctuation", ";"], + + "\r\n B", + ["arrow", "-->"], + "C", + ["punctuation", ";"], + + "\r\n C", + ["arrow", "-->"], + "D", + ["punctuation", ";"], + + "\r\n D", + ["arrow", "-->"], + "E", + ["punctuation", ";"], + + ["keyword", "click"], + " A ", + ["string", "\"http://www.github.com\""], + " _blank\r\n ", + + ["keyword", "click"], + " B ", + ["string", "\"http://www.github.com\""], + ["string", "\"Open this in a new tab\""], + " _blank\r\n ", + + ["keyword", "click"], + " C href ", + ["string", "\"http://www.github.com\""], + " _blank\r\n ", + + ["keyword", "click"], + " D href ", + ["string", "\"http://www.github.com\""], + ["string", "\"Open this in a new tab\""], + " _blank\r\n\r\n", + + ["keyword", "flowchart"], + " LR\r\n", + + ["comment", "%% this is a comment A -- text --> B{node}"], + + "\r\n A ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "text"], + ["arrow", "-->"] + ]], + " B ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "text2"], + ["arrow", "-->"] + ]], + " C\r\n\r\n", + + ["keyword", "linkStyle"], + " 3 ", + ["style", [ + ["property", "stroke"], + ["operator", ":"], + "#ff3", + ["punctuation", ","], + ["property", "stroke-width"], + ["operator", ":"], + "4px", + ["punctuation", ","], + ["property", "color"], + ["operator", ":"], + "red" + ]], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR\r\n id1", + ["text", "(Start)"], + ["arrow", "-->"], + "id2", + ["text", "(Stop)"], + + ["keyword", "style"], + " id1 ", + ["style", [ + ["property", "fill"], + ["operator", ":"], + "#f9f", + ["punctuation", ","], + ["property", "stroke"], + ["operator", ":"], + "#333", + ["punctuation", ","], + ["property", "stroke-width"], + ["operator", ":"], + "4px" + ]], + + ["keyword", "style"], + " id2 ", + ["style", [ + ["property", "fill"], + ["operator", ":"], + "#bbf", + ["punctuation", ","], + ["property", "stroke"], + ["operator", ":"], + "#f66", + ["punctuation", ","], + ["property", "stroke-width"], + ["operator", ":"], + "2px", + ["punctuation", ","], + ["property", "color"], + ["operator", ":"], + "#fff", + ["punctuation", ","], + ["property", "stroke-dasharray"], + ["operator", ":"], + " 5 5" + ]], + + ["keyword", "classDef"], + " className ", + ["style", [ + ["property", "fill"], + ["operator", ":"], + "#f9f", + ["punctuation", ","], + ["property", "stroke"], + ["operator", ":"], + "#333", + ["punctuation", ","], + ["property", "stroke-width"], + ["operator", ":"], + "4px" + ]], + ["punctuation", ";"], + + ["keyword", "class"], " nodeId1 className", ["punctuation", ";"], + + ["keyword", "class"], " nodeId1,nodeId2 className", ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR\r\n A", + ["operator", ":::"], + "someclass ", + ["arrow", "-->"], + " B\r\n ", + + ["keyword", "classDef"], + " someclass ", + ["style", [ + ["property", "fill"], + ["operator", ":"], + "#f96" + ]], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR", + ["punctuation", ";"], + + "\r\n A", + ["arrow", "-->"], + "B", + ["text", "[AAABBB]"], + ["punctuation", ";"], + + "\r\n B", + ["arrow", "-->"], + "D", + ["punctuation", ";"], + + ["keyword", "class"], + " A cssClass", + ["punctuation", ";"], + + ["keyword", "classDef"], + " default ", + ["style", [ + ["property", "fill"], + ["operator", ":"], + "#f9f", + ["punctuation", ","], + ["property", "stroke"], + ["operator", ":"], + "#333", + ["punctuation", ","], + ["property", "stroke-width"], + ["operator", ":"], + "4px" + ]], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " TD\r\n B", + ["text", "[\"fa:fa-twitter for peace\"]"], + + "\r\n B", + ["arrow", "-->"], + "C", + ["text", "[fa:fa-ban forbidden]"], + + "\r\n B", + ["arrow", "-->"], + "D", + ["text", "(fa:fa-spinner)"], + ["punctuation", ";"], + + "\r\n B", + ["arrow", "-->"], + "E", + ["text", "(A fa:fa-camera-retro perhaps?)"], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR\r\n A", + ["text", "[Hard edge]"], + ["arrow", "-->"], + ["label", "|Link text|"], + " B", + ["text", "(Round edge)"], + + "\r\n B ", + ["arrow", "-->"], + " C", + ["text", "{Decision}"], + + "\r\n C ", + ["arrow", "-->"], + ["label", "|One|"], + " D", + ["text", "[Result one]"], + + "\r\n C ", + ["arrow", "-->"], + ["label", "|Two|"], + " E", + ["text", "[Result two]"], + + ["keyword", "flowchart"], + " LR", + ["punctuation", ";"], + + "\r\n A", + ["arrow", "-->"], + "B", + ["punctuation", ";"], + + "\r\n B", + ["arrow", "-->"], + "C", + ["punctuation", ";"], + + "\r\n C", + ["arrow", "-->"], + "D", + ["punctuation", ";"], + + ["keyword", "click"], + " A callback ", + ["string", "\"Tooltip\""], + + ["keyword", "click"], + " B ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a link\""], + + ["keyword", "click"], + " C call callback", + ["punctuation", "("], + ["punctuation", ")"], + ["string", "\"Tooltip\""], + + ["keyword", "click"], + " D href ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a link\""] +] diff --git a/tests/languages/mermaid/full_sequencediagram.test b/tests/languages/mermaid/full_sequencediagram.test new file mode 100644 index 0000000000..ec954bc24d --- /dev/null +++ b/tests/languages/mermaid/full_sequencediagram.test @@ -0,0 +1,389 @@ +sequenceDiagram + Alice->>John: Hello John, how are you? + John-->>Alice: Great! + Alice-)John: See you later! + +sequenceDiagram + participant John + participant Alice + Alice->>John: Hello John, how are you? + John-->>Alice: Great! + +sequenceDiagram + participant A as Alice + participant J as John + A->>J: Hello John, how are you? + J->>A: Great! + +[Actor][Arrow][Actor]:Message text + +sequenceDiagram + Alice->>John: Hello John, how are you? + activate John + John-->>Alice: Great! + deactivate John + +sequenceDiagram + Alice->>+John: Hello John, how are you? + John-->>-Alice: Great! + +sequenceDiagram + Alice->>+John: Hello John, how are you? + Alice->>+John: John, can you hear me? + John-->>-Alice: Hi Alice, I can hear you! + John-->>-Alice: I feel great! + +sequenceDiagram + participant John + Note right of John: Text in note + +sequenceDiagram + Alice->John: Hello John, how are you? + Note over Alice,John: A typical interaction + +loop Loop text +... statements ... +end + +sequenceDiagram + Alice->John: Hello John, how are you? + loop Every minute + John-->Alice: Great! + end + +alt Describing text +... statements ... +else +... statements ... +end + +opt Describing text +... statements ... +end + +sequenceDiagram + Alice->>Bob: Hello Bob, how are you? + alt is sick + Bob->>Alice: Not so good :( + else is well + Bob->>Alice: Feeling fresh like a daisy + end + opt Extra response + Bob->>Alice: Thanks for asking + end + +par [Action 1] +... statements ... +and [Action 2] +... statements ... +and [Action N] +... statements ... +end + +rect rgb(0, 255, 0) +... content ... +end + +rect rgba(0, 0, 255, .1) +... content ... +end + +sequenceDiagram + Alice->>John: Hello John, how are you? + %% this is a comment + John-->>Alice: Great! + +sequenceDiagram + A->>B: I #9829; you! + B->>A: I #9829; you #infin; times more! + +sequenceDiagram + autonumber + Alice->>John: Hello John, how are you? + loop Healthcheck + John->>John: Fight against hypochondria + end + Note right of John: Rational thoughts! + John-->>Alice: Great! + John->>Bob: How about you? + Bob-->>John: Jolly good! + +---------------------------------------------------- + +[ + ["keyword", "sequenceDiagram"], + + "\r\n Alice", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Hello John, how are you?\r\n John", + ["arrow", "-->>"], + "Alice", + ["operator", ":"], + " Great!\r\n Alice", + ["arrow", "-)"], + "John", + ["operator", ":"], + " See you later!\r\n\r\n", + + ["keyword", "sequenceDiagram"], + + ["keyword", "participant"], + " John\r\n ", + + ["keyword", "participant"], + " Alice\r\n Alice", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Hello John, how are you?\r\n John", + ["arrow", "-->>"], + "Alice", + ["operator", ":"], + " Great!\r\n\r\n", + + ["keyword", "sequenceDiagram"], + + ["keyword", "participant"], + " A as Alice\r\n ", + + ["keyword", "participant"], + " J as John\r\n A", + ["arrow", "->>"], + "J", + ["operator", ":"], + " Hello John, how are you?\r\n J", + ["arrow", "->>"], + "A", + ["operator", ":"], + " Great!\r\n\r\n", + + ["text", "[Actor]"], + ["text", "[Arrow]"], + ["text", "[Actor]"], + ["operator", ":"], + "Message text\r\n\r\n", + + ["keyword", "sequenceDiagram"], + + "\r\n Alice", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Hello John, how are you?\r\n ", + + ["keyword", "activate"], + " John\r\n John", + ["arrow", "-->>"], + "Alice", + ["operator", ":"], + " Great!\r\n ", + + ["keyword", "deactivate"], + " John\r\n\r\n", + + ["keyword", "sequenceDiagram"], + + "\r\n Alice", + ["arrow", "->>"], + "+John", + ["operator", ":"], + " Hello John, how are you?\r\n John", + ["arrow", "-->>"], + "-Alice", + ["operator", ":"], + " Great!\r\n\r\n", + + ["keyword", "sequenceDiagram"], + + "\r\n Alice", + ["arrow", "->>"], + "+John", + ["operator", ":"], + " Hello John, how are you?\r\n Alice", + ["arrow", "->>"], + "+John", + ["operator", ":"], + " John, can you hear me?\r\n John", + ["arrow", "-->>"], + "-Alice", + ["operator", ":"], + " Hi Alice, I can hear you!\r\n John", + ["arrow", "-->>"], + "-Alice", + ["operator", ":"], + " I feel great!\r\n\r\n", + + ["keyword", "sequenceDiagram"], + + ["keyword", "participant"], + " John\r\n ", + + ["keyword", "Note right of"], + " John", + ["operator", ":"], + " Text in note\r\n\r\n", + + ["keyword", "sequenceDiagram"], + + "\r\n Alice", + ["arrow", "->"], + "John", + ["operator", ":"], + " Hello John, how are you?\r\n ", + + ["keyword", "Note over"], + " Alice,John", + ["operator", ":"], + " A typical interaction\r\n\r\n", + + ["keyword", "loop"], " Loop text\r\n... statements ...\r\n", + ["keyword", "end"], + + ["keyword", "sequenceDiagram"], + + "\r\n Alice", + ["arrow", "->"], + "John", + ["operator", ":"], + " Hello John, how are you?\r\n ", + + ["keyword", "loop"], + " Every minute\r\n John", + ["arrow", "-->"], + "Alice", + ["operator", ":"], + " Great!\r\n ", + + ["keyword", "end"], + + ["keyword", "alt"], " Describing text\r\n... statements ...\r\n", + ["keyword", "else"], + "\r\n... statements ...\r\n", + ["keyword", "end"], + + ["keyword", "opt"], " Describing text\r\n... statements ...\r\n", + ["keyword", "end"], + + ["keyword", "sequenceDiagram"], + + "\r\n Alice", + ["arrow", "->>"], + "Bob", + ["operator", ":"], + " Hello Bob, how are you?\r\n ", + + ["keyword", "alt"], + " is sick\r\n Bob", + ["arrow", "->>"], + "Alice", + ["operator", ":"], + " Not so good ", + ["operator", ":"], + ["punctuation", "("], + + ["keyword", "else"], + " is well\r\n Bob", + ["arrow", "->>"], + "Alice", + ["operator", ":"], + " Feeling fresh like a daisy\r\n ", + + ["keyword", "end"], + + ["keyword", "opt"], + " Extra response\r\n Bob", + ["arrow", "->>"], + "Alice", + ["operator", ":"], + " Thanks for asking\r\n ", + + ["keyword", "end"], + + ["keyword", "par"], ["text", "[Action 1]"], + "\r\n... statements ...\r\n", + ["keyword", "and"], ["text", "[Action 2]"], + "\r\n... statements ...\r\n", + ["keyword", "and"], ["text", "[Action N]"], + "\r\n... statements ...\r\n", + ["keyword", "end"], + + ["keyword", "rect"], " rgb", ["text", "(0, 255, 0)"], + "\r\n... content ...\r\n", + ["keyword", "end"], + + ["keyword", "rect"], " rgba", ["text", "(0, 0, 255, .1)"], + "\r\n... content ...\r\n", + ["keyword", "end"], + + ["keyword", "sequenceDiagram"], + + "\r\n Alice", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Hello John, how are you?\r\n ", + + ["comment", "%% this is a comment"], + + "\r\n John", + ["arrow", "-->>"], + "Alice", + ["operator", ":"], + " Great!\r\n\r\n", + + ["keyword", "sequenceDiagram"], + + "\r\n A", + ["arrow", "->>"], + "B", + ["operator", ":"], + " I ", + ["entity", "#9829;"], + " you!\r\n B", + ["arrow", "->>"], + "A", + ["operator", ":"], + " I ", + ["entity", "#9829;"], + " you ", + ["entity", "#infin;"], + " times more!\r\n\r\n", + + ["keyword", "sequenceDiagram"], + + ["keyword", "autonumber"], + + "\r\n Alice", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Hello John, how are you?\r\n ", + + ["keyword", "loop"], + " Healthcheck\r\n John", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Fight against hypochondria\r\n ", + + ["keyword", "end"], + + ["keyword", "Note right of"], + " John", + ["operator", ":"], + " Rational thoughts!\r\n John", + ["arrow", "-->>"], + "Alice", + ["operator", ":"], + " Great!\r\n John", + ["arrow", "->>"], + "Bob", + ["operator", ":"], + " How about you?\r\n Bob", + ["arrow", "-->>"], + "John", + ["operator", ":"], + " Jolly good!" +] diff --git a/tests/languages/mermaid/full_statediagram.test b/tests/languages/mermaid/full_statediagram.test new file mode 100644 index 0000000000..a5d1f27bf4 --- /dev/null +++ b/tests/languages/mermaid/full_statediagram.test @@ -0,0 +1,430 @@ +stateDiagram-v2 + [*] --> Still + Still --> [*] + + Still --> Moving + Moving --> Still + Moving --> Crash + Crash --> [*] + +stateDiagram-v2 + s1 --> s2 + +stateDiagram-v2 + s1 --> s2: A transition + +stateDiagram-v2 + [*] --> s1 + s1 --> [*] + +stateDiagram-v2 + [*] --> First + state First { + [*] --> second + second --> [*] + } + +stateDiagram-v2 + [*] --> First + + state First { + [*] --> Second + + state Second { + [*] --> second + second --> Third + + state Third { + [*] --> third + third --> [*] + } + } + } + +stateDiagram-v2 + [*] --> First + First --> Second + First --> Third + + state First { + [*] --> fir + fir --> [*] + } + state Second { + [*] --> sec + sec --> [*] + } + state Third { + [*] --> thi + thi --> [*] + } + +stateDiagram-v2 + state if_state <> + [*] --> IsPositive + IsPositive --> if_state + if_state --> False: if n < 0 + if_state --> True : if n >= 0 + +stateDiagram-v2 + state fork_state <> + [*] --> fork_state + fork_state --> State2 + fork_state --> State3 + + state join_state <> + State2 --> join_state + State3 --> join_state + join_state --> State4 + State4 --> [*] + +stateDiagram-v2 + State1: The state with a note + note right of State1 + Important information! You can write + notes. + end note + State1 --> State2 + note left of State2 : This is the note to the left. + +stateDiagram-v2 + [*] --> Active + + state Active { + [*] --> NumLockOff + NumLockOff --> NumLockOn : EvNumLockPressed + NumLockOn --> NumLockOff : EvNumLockPressed + -- + [*] --> CapsLockOff + CapsLockOff --> CapsLockOn : EvCapsLockPressed + CapsLockOn --> CapsLockOff : EvCapsLockPressed + -- + [*] --> ScrollLockOff + ScrollLockOff --> ScrollLockOn : EvScrollLockPressed + ScrollLockOn --> ScrollLockOff : EvScrollLockPressed + } + +stateDiagram + direction LR + [*] --> A + A --> B + B --> C + state B { + direction LR + a --> b + } + B --> D + +stateDiagram-v2 + [*] --> Still + Still --> [*] +%% this is a comment + Still --> Moving + Moving --> Still %% another comment + Moving --> Crash + Crash --> [*] + +---------------------------------------------------- + +[ + ["keyword", "stateDiagram-v2"], + + ["text", "[*]"], + ["arrow", "-->"], + " Still\r\n Still ", + ["arrow", "-->"], + ["text", "[*]"], + + "\r\n\r\n Still ", + ["arrow", "-->"], + " Moving\r\n Moving ", + ["arrow", "-->"], + " Still\r\n Moving ", + ["arrow", "-->"], + " Crash\r\n Crash ", + ["arrow", "-->"], + ["text", "[*]"], + + ["keyword", "stateDiagram-v2"], + "\r\n s1 ", ["arrow", "-->"], " s2\r\n\r\n", + + ["keyword", "stateDiagram-v2"], + + "\r\n s1 ", + ["arrow", "-->"], + " s2", + ["operator", ":"], + " A transition\r\n\r\n", + + ["keyword", "stateDiagram-v2"], + + ["text", "[*]"], + ["arrow", "-->"], + " s1\r\n s1 ", + ["arrow", "-->"], + ["text", "[*]"], + + ["keyword", "stateDiagram-v2"], + + ["text", "[*]"], + ["arrow", "-->"], + " First\r\n ", + + ["keyword", "state"], + " First ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " second\r\n second ", + ["arrow", "-->"], + ["text", "[*]"], + + ["punctuation", "}"], + + ["keyword", "stateDiagram-v2"], + ["text", "[*]"], ["arrow", "-->"], " First\r\n\r\n ", + + ["keyword", "state"], " First ", ["punctuation", "{"], + ["text", "[*]"], ["arrow", "-->"], " Second\r\n\r\n ", + + ["keyword", "state"], + " Second ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " second\r\n second ", + ["arrow", "-->"], + " Third\r\n\r\n ", + + ["keyword", "state"], + " Third ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " third\r\n third ", + ["arrow", "-->"], + ["text", "[*]"], + + ["punctuation", "}"], + + ["punctuation", "}"], + + ["punctuation", "}"], + + ["keyword", "stateDiagram-v2"], + + ["text", "[*]"], + ["arrow", "-->"], + " First\r\n First ", + ["arrow", "-->"], + " Second\r\n First ", + ["arrow", "-->"], + " Third\r\n\r\n ", + + ["keyword", "state"], + " First ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " fir\r\n fir ", + ["arrow", "-->"], + ["text", "[*]"], + + ["punctuation", "}"], + + ["keyword", "state"], + " Second ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " sec\r\n sec ", + ["arrow", "-->"], + ["text", "[*]"], + + ["punctuation", "}"], + + ["keyword", "state"], + " Third ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " thi\r\n thi ", + ["arrow", "-->"], + ["text", "[*]"], + + ["punctuation", "}"], + + ["keyword", "stateDiagram-v2"], + + ["keyword", "state"], + " if_state ", + ["annotation", "<>"], + + ["text", "[*]"], + ["arrow", "-->"], + " IsPositive\r\n IsPositive ", + ["arrow", "-->"], + " if_state\r\n if_state ", + ["arrow", "-->"], + " False", + ["operator", ":"], + " if n < 0\r\n if_state ", + ["arrow", "-->"], + " True ", + ["operator", ":"], + " if n >= 0\r\n\r\n", + + ["keyword", "stateDiagram-v2"], + + ["keyword", "state"], + " fork_state ", + ["annotation", "<>"], + + ["text", "[*]"], + ["arrow", "-->"], + " fork_state\r\n fork_state ", + ["arrow", "-->"], + " State2\r\n fork_state ", + ["arrow", "-->"], + " State3\r\n\r\n ", + + ["keyword", "state"], + " join_state ", + ["annotation", "<>"], + + "\r\n State2 ", + ["arrow", "-->"], + " join_state\r\n State3 ", + ["arrow", "-->"], + " join_state\r\n join_state ", + ["arrow", "-->"], + " State4\r\n State4 ", + ["arrow", "-->"], + ["text", "[*]"], + + ["keyword", "stateDiagram-v2"], + + "\r\n State1", + ["operator", ":"], + " The state with a note\r\n ", + + ["keyword", "note right of"], + " State1\r\n Important information! You can write\r\n notes.\r\n ", + + ["keyword", "end note"], + + "\r\n State1 ", + ["arrow", "-->"], + " State2\r\n ", + + ["keyword", "note left of"], + " State2 ", + ["operator", ":"], + " This is the note to the left.\r\n\r\n", + + ["keyword", "stateDiagram-v2"], + ["text", "[*]"], ["arrow", "-->"], " Active\r\n\r\n ", + + ["keyword", "state"], + " Active ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " NumLockOff\r\n NumLockOff ", + ["arrow", "-->"], + " NumLockOn ", + ["operator", ":"], + " EvNumLockPressed\r\n NumLockOn ", + ["arrow", "-->"], + " NumLockOff ", + ["operator", ":"], + " EvNumLockPressed\r\n ", + + ["arrow", "--"], + + ["text", "[*]"], + ["arrow", "-->"], + " CapsLockOff\r\n CapsLockOff ", + ["arrow", "-->"], + " CapsLockOn ", + ["operator", ":"], + " EvCapsLockPressed\r\n CapsLockOn ", + ["arrow", "-->"], + " CapsLockOff ", + ["operator", ":"], + " EvCapsLockPressed\r\n ", + + ["arrow", "--"], + + ["text", "[*]"], + ["arrow", "-->"], + " ScrollLockOff\r\n ScrollLockOff ", + ["arrow", "-->"], + " ScrollLockOn ", + ["operator", ":"], + " EvScrollLockPressed\r\n ScrollLockOn ", + ["arrow", "-->"], + " ScrollLockOff ", + ["operator", ":"], + " EvScrollLockPressed\r\n ", + + ["punctuation", "}"], + + ["keyword", "stateDiagram"], + + ["keyword", "direction"], + " LR\r\n ", + + ["text", "[*]"], + ["arrow", "-->"], + " A\r\n A ", + ["arrow", "-->"], + " B\r\n B ", + ["arrow", "-->"], + " C\r\n ", + + ["keyword", "state"], + " B ", + ["punctuation", "{"], + + ["keyword", "direction"], + " LR\r\n a ", + ["arrow", "-->"], + " b\r\n ", + + ["punctuation", "}"], + + "\r\n B ", + ["arrow", "-->"], + " D\r\n\r\n", + + ["keyword", "stateDiagram-v2"], + + ["text", "[*]"], + ["arrow", "-->"], + " Still\r\n Still ", + ["arrow", "-->"], + ["text", "[*]"], + + ["comment", "%% this is a comment"], + + "\r\n Still ", + ["arrow", "-->"], + " Moving\r\n Moving ", + ["arrow", "-->"], + " Still ", + ["comment", "%% another comment"], + + "\r\n Moving ", + ["arrow", "-->"], + " Crash\r\n Crash ", + ["arrow", "-->"], + ["text", "[*]"] +] diff --git a/tests/languages/mermaid/inter-arrow-label_feature.test b/tests/languages/mermaid/inter-arrow-label_feature.test new file mode 100644 index 0000000000..8c07daf5a3 --- /dev/null +++ b/tests/languages/mermaid/inter-arrow-label_feature.test @@ -0,0 +1,62 @@ +A -.s .- C +A -. s .- C +A -. "asdasd" .- C +A -- "asdasd" --> C +A -- "asdasd" --> C +A -- "asdasd" .- C +A -- "asdasd" === C +A -- "asdasd" ==> C + +---------------------------------------------------- + +[ + "A ", + ["inter-arrow-label", [ + ["arrow-head", "-."], + ["label", "s"], + ["arrow", ".-"] + ]], + " C\r\nA ", + ["inter-arrow-label", [ + ["arrow-head", "-."], + ["label", "s"], + ["arrow", ".-"] + ]], + " C\r\nA ", + ["inter-arrow-label", [ + ["arrow-head", "-."], + ["label", "\"asdasd\""], + ["arrow", ".-"] + ]], + " C\r\nA ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "\"asdasd\""], + ["arrow", "-->"] + ]], + " C\r\nA ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "\"asdasd\""], + ["arrow", "-->"] + ]], + " C\r\nA ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "\"asdasd\""], + ["arrow", ".-"] + ]], + " C\r\nA ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "\"asdasd\""], + ["arrow", "==="] + ]], + " C\r\nA ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "\"asdasd\""], + ["arrow", "==>"] + ]], + " C" +] diff --git a/tests/languages/mermaid/operator_feature.test b/tests/languages/mermaid/operator_feature.test new file mode 100644 index 0000000000..7ee9a5fbe6 --- /dev/null +++ b/tests/languages/mermaid/operator_feature.test @@ -0,0 +1,11 @@ +A & B + +: ::: + +---------------------------------------------------- + +[ + "A ", ["operator", "&"], " B\r\n\r\n", + + ["operator", ":"], ["operator", ":::"] +]