fixes, additions to prism's pwsh syntax highlight, tweak to markup only pushing these now (as opposed to the init commit) to better keep track of changes to these files

+8 -434
public/prism.js
··· 1 1 /* PrismJS 1.30.0 2 - https://prismjs.com/download#themes=prism&plugins=custom-class+show-language+autoloader+toolbar+copy-to-clipboard+treeview */ 2 + https://prismjs.com/download#themes=prism&plugins=custom-class+show-language+autoloader+toolbar+copy-to-clipboard */ 3 3 /// <reference lib="WebWorker"/> 4 4 5 5 var _self = (typeof window !== 'undefined') ··· 1585 1585 "css": "CSS", 1586 1586 "clike": "C-like", 1587 1587 "js": "JavaScript", 1588 - "abap": "ABAP", 1589 - "abnf": "ABNF", 1590 - "al": "AL", 1591 - "antlr4": "ANTLR4", 1592 - "g4": "ANTLR4", 1593 - "apacheconf": "Apache Configuration", 1594 - "apl": "APL", 1595 - "aql": "AQL", 1596 - "ino": "Arduino", 1597 - "arff": "ARFF", 1598 - "armasm": "ARM Assembly", 1599 - "arm-asm": "ARM Assembly", 1600 - "art": "Arturo", 1601 - "asciidoc": "AsciiDoc", 1602 - "adoc": "AsciiDoc", 1603 - "aspnet": "ASP.NET (C#)", 1604 - "asm6502": "6502 Assembly", 1605 - "asmatmel": "Atmel AVR Assembly", 1606 1588 "autohotkey": "AutoHotkey", 1607 - "autoit": "AutoIt", 1608 - "avisynth": "AviSynth", 1609 - "avs": "AviSynth", 1610 - "avro-idl": "Avro IDL", 1611 - "avdl": "Avro IDL", 1612 1589 "awk": "AWK", 1613 1590 "gawk": "GAWK", 1614 1591 "sh": "Shell", 1615 - "basic": "BASIC", 1616 - "bbcode": "BBcode", 1617 - "bbj": "BBj", 1618 - "bnf": "BNF", 1619 - "rbnf": "RBNF", 1620 - "bqn": "BQN", 1621 - "bsl": "BSL (1C:Enterprise)", 1622 - "oscript": "OneScript", 1623 1592 "csharp": "C#", 1624 1593 "cs": "C#", 1625 1594 "dotnet": "C#", 1626 1595 "cpp": "C++", 1627 - "cfscript": "CFScript", 1628 - "cfc": "CFScript", 1629 - "cil": "CIL", 1630 - "cilkc": "Cilk/C", 1631 - "cilk-c": "Cilk/C", 1632 - "cilkcpp": "Cilk/C++", 1633 - "cilk-cpp": "Cilk/C++", 1634 - "cilk": "Cilk/C++", 1635 - "cmake": "CMake", 1636 - "cobol": "COBOL", 1637 - "coffee": "CoffeeScript", 1638 - "conc": "Concurnas", 1639 - "csp": "Content-Security-Policy", 1640 1596 "css-extras": "CSS Extras", 1641 1597 "csv": "CSV", 1642 - "cue": "CUE", 1643 - "dataweave": "DataWeave", 1644 - "dax": "DAX", 1645 - "django": "Django/Jinja2", 1646 - "jinja2": "Django/Jinja2", 1647 - "dns-zone-file": "DNS zone file", 1648 - "dns-zone": "DNS zone file", 1649 1598 "dockerfile": "Docker", 1650 - "dot": "DOT (Graphviz)", 1651 - "gv": "DOT (Graphviz)", 1652 - "ebnf": "EBNF", 1653 - "editorconfig": "EditorConfig", 1654 1599 "ejs": "EJS", 1655 - "etlua": "Embedded Lua templating", 1656 - "erb": "ERB", 1657 - "excel-formula": "Excel Formula", 1658 - "xlsx": "Excel Formula", 1659 - "xls": "Excel Formula", 1660 - "fsharp": "F#", 1661 - "firestore-security-rules": "Firestore security rules", 1662 - "ftl": "FreeMarker Template Language", 1663 - "gml": "GameMaker Language", 1664 - "gamemakerlanguage": "GameMaker Language", 1665 - "gap": "GAP (CAS)", 1666 - "gcode": "G-code", 1667 - "gdscript": "GDScript", 1668 - "gedcom": "GEDCOM", 1669 - "gettext": "gettext", 1670 - "po": "gettext", 1671 - "glsl": "GLSL", 1672 - "gn": "GN", 1673 - "gni": "GN", 1674 - "linker-script": "GNU Linker Script", 1675 - "ld": "GNU Linker Script", 1676 - "go-module": "Go module", 1677 - "go-mod": "Go module", 1678 - "graphql": "GraphQL", 1679 - "hbs": "Handlebars", 1680 - "hs": "Haskell", 1681 - "hcl": "HCL", 1682 - "hlsl": "HLSL", 1683 1600 "http": "HTTP", 1684 - "hpkp": "HTTP Public-Key-Pins", 1685 - "hsts": "HTTP Strict-Transport-Security", 1686 - "ichigojam": "IchigoJam", 1687 - "icu-message-format": "ICU Message Format", 1688 - "idr": "Idris", 1689 1601 "ignore": ".ignore", 1690 1602 "gitignore": ".gitignore", 1691 1603 "hgignore": ".hgignore", 1692 1604 "npmignore": ".npmignore", 1693 - "inform7": "Inform 7", 1694 1605 "javadoc": "JavaDoc", 1695 1606 "javadoclike": "JavaDoc-like", 1696 1607 "javastacktrace": "Java stack trace", 1697 - "jq": "JQ", 1698 1608 "jsdoc": "JSDoc", 1699 1609 "js-extras": "JS Extras", 1700 1610 "json": "JSON", 1701 1611 "webmanifest": "Web App Manifest", 1702 1612 "json5": "JSON5", 1703 - "jsonp": "JSONP", 1704 1613 "jsstacktrace": "JS stack trace", 1705 1614 "js-templates": "JS Templates", 1706 - "keepalived": "Keepalived Configure", 1707 1615 "kts": "Kotlin Script", 1708 1616 "kt": "Kotlin", 1709 - "kumir": "KuMir (КуМир)", 1710 - "kum": "KuMir (КуМир)", 1711 - "latex": "LaTeX", 1712 - "tex": "TeX", 1713 - "context": "ConTeXt", 1714 - "lilypond": "LilyPond", 1715 - "ly": "LilyPond", 1716 - "emacs": "Lisp", 1717 - "elisp": "Lisp", 1718 - "emacs-lisp": "Lisp", 1719 - "llvm": "LLVM IR", 1720 - "log": "Log file", 1721 - "lolcode": "LOLCODE", 1722 - "magma": "Magma (CAS)", 1723 1617 "md": "Markdown", 1724 - "markup-templating": "Markup templating", 1725 - "matlab": "MATLAB", 1726 - "maxscript": "MAXScript", 1727 - "mel": "MEL", 1728 - "metafont": "METAFONT", 1729 1618 "mongodb": "MongoDB", 1730 - "moon": "MoonScript", 1731 - "n1ql": "N1QL", 1732 - "n4js": "N4JS", 1733 - "n4jsd": "N4JS", 1734 - "nand2tetris-hdl": "Nand To Tetris HDL", 1735 - "naniscript": "Naninovel Script", 1736 - "nani": "Naninovel Script", 1737 - "nasm": "NASM", 1738 - "neon": "NEON", 1739 - "nginx": "nginx", 1740 - "nsis": "NSIS", 1741 - "objectivec": "Objective-C", 1742 - "objc": "Objective-C", 1743 - "ocaml": "OCaml", 1744 - "opencl": "OpenCL", 1745 - "openqasm": "OpenQasm", 1746 - "qasm": "OpenQasm", 1747 - "parigp": "PARI/GP", 1748 - "objectpascal": "Object Pascal", 1749 - "psl": "PATROL Scripting Language", 1750 - "pcaxis": "PC-Axis", 1751 - "px": "PC-Axis", 1752 - "peoplecode": "PeopleCode", 1753 - "pcode": "PeopleCode", 1754 - "php": "PHP", 1755 - "phpdoc": "PHPDoc", 1756 - "php-extras": "PHP Extras", 1757 - "plant-uml": "PlantUML", 1758 - "plantuml": "PlantUML", 1759 - "plsql": "PL/SQL", 1760 - "powerquery": "PowerQuery", 1761 - "pq": "PowerQuery", 1762 - "mscript": "PowerQuery", 1763 - "powershell": "PowerShell", 1764 - "promql": "PromQL", 1619 + "pwsh": "PowerShell", 1620 + "pwsh-mizumiya": "PowerShell with Mizumiya", 1621 + "pwsh-functionsignature": "PowerShell function signature", 1765 1622 "properties": ".properties", 1766 - "protobuf": "Protocol Buffers", 1767 - "purebasic": "PureBasic", 1768 - "pbfasm": "PureBasic", 1769 - "purs": "PureScript", 1770 1623 "py": "Python", 1771 - "qsharp": "Q#", 1772 - "qs": "Q#", 1773 - "q": "Q (kdb+ database)", 1774 - "qml": "QML", 1775 - "rkt": "Racket", 1776 - "cshtml": "Razor C#", 1777 - "razor": "Razor C#", 1778 - "jsx": "React JSX", 1779 - "tsx": "React TSX", 1780 - "renpy": "Ren'py", 1781 - "rpy": "Ren'py", 1782 - "res": "ReScript", 1783 - "rest": "reST (reStructuredText)", 1784 - "robotframework": "Robot Framework", 1785 - "robot": "Robot Framework", 1786 1624 "rb": "Ruby", 1787 - "sas": "SAS", 1788 - "sass": "Sass (Sass)", 1789 - "scss": "Sass (SCSS)", 1790 1625 "shell-session": "Shell session", 1791 1626 "sh-session": "Shell session", 1792 1627 "shellsession": "Shell session", 1793 - "sml": "SML", 1794 - "smlnj": "SML/NJ", 1795 - "solidity": "Solidity (Ethereum)", 1796 - "sol": "Solidity (Ethereum)", 1797 - "solution-file": "Solution file", 1798 - "sln": "Solution file", 1799 - "soy": "Soy (Closure Template)", 1800 - "sparql": "SPARQL", 1801 - "rq": "SPARQL", 1802 - "splunk-spl": "Splunk SPL", 1803 - "sqf": "SQF: Status Quo Function (Arma 3)", 1804 1628 "sql": "SQL", 1805 - "stata": "Stata Ado", 1806 - "iecst": "Structured Text (IEC 61131-3)", 1807 - "supercollider": "SuperCollider", 1808 - "sclang": "SuperCollider", 1809 1629 "systemd": "Systemd configuration file", 1810 - "t4-templating": "T4 templating", 1811 - "t4-cs": "T4 Text Templates (C#)", 1812 - "t4": "T4 Text Templates (C#)", 1813 - "t4-vb": "T4 Text Templates (VB)", 1814 - "tap": "TAP", 1815 - "tt2": "Template Toolkit 2", 1816 - "toml": "TOML", 1817 - "trickle": "trickle", 1818 - "troy": "troy", 1819 - "trig": "TriG", 1820 1630 "ts": "TypeScript", 1821 1631 "tsconfig": "TSConfig", 1822 - "uscript": "UnrealScript", 1823 - "uc": "UnrealScript", 1824 - "uorazor": "UO Razor Script", 1825 1632 "uri": "URI", 1826 1633 "url": "URL", 1827 - "vbnet": "VB.Net", 1828 - "vhdl": "VHDL", 1829 - "vim": "vim", 1830 - "visual-basic": "Visual Basic", 1831 - "vba": "VBA", 1832 - "vb": "Visual Basic", 1833 - "wasm": "WebAssembly", 1834 - "web-idl": "Web IDL", 1835 - "webidl": "Web IDL", 1836 - "wgsl": "WGSL", 1837 - "wiki": "Wiki markup", 1838 - "wolfram": "Wolfram language", 1839 - "nb": "Mathematica Notebook", 1840 - "wl": "Wolfram language", 1841 - "xeoracube": "XeoraCube", 1842 1634 "xml-doc": "XML doc (.net)", 1843 - "xojo": "Xojo (REALbasic)", 1844 - "xquery": "XQuery", 1845 1635 "yaml": "YAML", 1846 - "yml": "YAML", 1847 - "yang": "YANG" 1636 + "yml": "YAML" 1848 1637 }/*]*/; 1849 1638 1850 1639 /* eslint-enable */ ··· 1896 1685 */ 1897 1686 var lang_dependencies = /*dependencies_placeholder[*/{ 1898 1687 "javascript": "clike", 1899 - "actionscript": "javascript", 1900 - "apex": [ 1901 - "clike", 1902 - "sql" 1903 - ], 1904 - "arduino": "cpp", 1905 - "aspnet": [ 1906 - "markup", 1907 - "csharp" 1908 - ], 1909 - "birb": "clike", 1910 - "bison": "c", 1911 1688 "c": "clike", 1912 1689 "csharp": "clike", 1913 1690 "cpp": "c", 1914 - "cfscript": "clike", 1915 - "chaiscript": [ 1916 - "clike", 1917 - "cpp" 1918 - ], 1919 - "cilkc": "c", 1920 - "cilkcpp": "cpp", 1921 - "coffeescript": "javascript", 1922 - "crystal": "ruby", 1923 1691 "css-extras": "css", 1924 - "d": "clike", 1925 - "dart": "clike", 1926 - "django": "markup-templating", 1927 1692 "ejs": [ 1928 1693 "javascript", 1929 1694 "markup-templating" 1930 1695 ], 1931 - "etlua": [ 1932 - "lua", 1933 - "markup-templating" 1934 - ], 1935 - "erb": [ 1936 - "ruby", 1937 - "markup-templating" 1938 - ], 1939 - "fsharp": "clike", 1940 - "firestore-security-rules": "clike", 1941 - "flow": "javascript", 1942 - "ftl": "markup-templating", 1943 - "gml": "clike", 1944 - "glsl": "c", 1945 - "go": "clike", 1946 1696 "gradle": "clike", 1947 - "groovy": "clike", 1948 - "haml": "ruby", 1949 - "handlebars": "markup-templating", 1950 - "haxe": "clike", 1951 - "hlsl": "c", 1952 - "idris": "haskell", 1953 1697 "java": "clike", 1954 1698 "javadoc": [ 1955 1699 "markup", 1956 1700 "java", 1957 1701 "javadoclike" 1958 1702 ], 1959 - "jolie": "clike", 1960 1703 "jsdoc": [ 1961 1704 "javascript", 1962 1705 "javadoclike", ··· 1964 1707 ], 1965 1708 "js-extras": "javascript", 1966 1709 "json5": "json", 1967 - "jsonp": "json", 1968 1710 "js-templates": "javascript", 1969 1711 "kotlin": "clike", 1970 - "latte": [ 1971 - "clike", 1972 - "markup-templating", 1973 - "php" 1974 - ], 1975 - "less": "css", 1976 - "lilypond": "scheme", 1977 - "liquid": "markup-templating", 1978 1712 "markdown": "markup", 1979 - "markup-templating": "markup", 1980 1713 "mongodb": "javascript", 1981 - "n4js": "javascript", 1982 - "objectivec": "c", 1983 - "opencl": "c", 1984 - "parser": "markup", 1985 - "php": "markup-templating", 1986 - "phpdoc": [ 1987 - "php", 1988 - "javadoclike" 1989 - ], 1990 - "php-extras": "php", 1991 1714 "plsql": "sql", 1992 - "processing": "clike", 1993 - "protobuf": "clike", 1994 - "pug": [ 1995 - "markup", 1996 - "javascript" 1997 - ], 1998 - "purebasic": "clike", 1999 - "purescript": "haskell", 2000 - "qsharp": "clike", 2001 - "qml": "javascript", 2002 - "qore": "clike", 2003 - "racket": "scheme", 2004 - "cshtml": [ 2005 - "markup", 2006 - "csharp" 2007 - ], 2008 - "jsx": [ 2009 - "markup", 2010 - "javascript" 2011 - ], 2012 - "tsx": [ 2013 - "jsx", 2014 - "typescript" 2015 - ], 2016 - "reason": "clike", 1715 + "pwsh-mizumiya": "pwsh", 2017 1716 "ruby": "clike", 2018 - "sass": "css", 2019 - "scss": "css", 2020 - "scala": "java", 2021 1717 "shell-session": "bash", 2022 - "smarty": "markup-templating", 2023 - "solidity": "clike", 2024 - "soy": "markup-templating", 2025 - "sparql": "turtle", 2026 - "sqf": "clike", 2027 - "squirrel": "clike", 2028 - "stata": [ 2029 - "mata", 2030 - "java", 2031 - "python" 2032 - ], 2033 - "t4-cs": [ 2034 - "t4-templating", 2035 - "csharp" 2036 - ], 2037 - "t4-vb": [ 2038 - "t4-templating", 2039 - "vbnet" 2040 - ], 2041 - "tap": "yaml", 2042 - "tt2": [ 2043 - "clike", 2044 - "markup-templating" 2045 - ], 2046 - "textile": "markup", 2047 - "twig": "markup-templating", 2048 1718 "typescript": "javascript", 2049 - "v": "clike", 2050 - "vala": "clike", 2051 - "vbnet": "basic", 2052 - "velocity": "markup", 2053 - "wiki": "markup", 2054 - "xeora": "markup", 2055 1719 "xml-doc": "markup", 2056 - "xquery": "markup" 2057 1720 }/*]*/; 2058 1721 2059 1722 var lang_aliases = /*aliases_placeholder[*/{ ··· 2065 1728 "atom": "markup", 2066 1729 "rss": "markup", 2067 1730 "js": "javascript", 2068 - "g4": "antlr4", 2069 - "ino": "arduino", 2070 - "arm-asm": "armasm", 2071 - "art": "arturo", 2072 - "adoc": "asciidoc", 2073 - "avs": "avisynth", 2074 - "avdl": "avro-idl", 2075 1731 "gawk": "awk", 2076 1732 "sh": "bash", 2077 1733 "shell": "bash", 2078 - "shortcode": "bbcode", 2079 - "rbnf": "bnf", 2080 - "oscript": "bsl", 2081 1734 "cs": "csharp", 2082 1735 "dotnet": "csharp", 2083 - "cfc": "cfscript", 2084 - "cilk-c": "cilkc", 2085 - "cilk-cpp": "cilkcpp", 2086 - "cilk": "cilkcpp", 2087 - "coffee": "coffeescript", 2088 - "conc": "concurnas", 2089 - "jinja2": "django", 2090 - "dns-zone": "dns-zone-file", 2091 1736 "dockerfile": "docker", 2092 - "gv": "dot", 2093 1737 "eta": "ejs", 2094 - "xlsx": "excel-formula", 2095 - "xls": "excel-formula", 2096 - "gamemakerlanguage": "gml", 2097 - "po": "gettext", 2098 - "gni": "gn", 2099 - "ld": "linker-script", 2100 - "go-mod": "go-module", 2101 - "hbs": "handlebars", 2102 - "mustache": "handlebars", 2103 - "hs": "haskell", 2104 - "idr": "idris", 2105 1738 "gitignore": "ignore", 2106 1739 "hgignore": "ignore", 2107 1740 "npmignore": "ignore", 2108 1741 "webmanifest": "json", 2109 1742 "kt": "kotlin", 2110 1743 "kts": "kotlin", 2111 - "kum": "kumir", 2112 - "tex": "latex", 2113 - "context": "latex", 2114 - "ly": "lilypond", 2115 - "emacs": "lisp", 2116 - "elisp": "lisp", 2117 - "emacs-lisp": "lisp", 2118 1744 "md": "markdown", 2119 - "moon": "moonscript", 2120 - "n4jsd": "n4js", 2121 - "nani": "naniscript", 2122 - "objc": "objectivec", 2123 - "qasm": "openqasm", 2124 - "objectpascal": "pascal", 2125 - "px": "pcaxis", 2126 - "pcode": "peoplecode", 2127 - "plantuml": "plant-uml", 2128 - "pq": "powerquery", 2129 - "mscript": "powerquery", 2130 - "pbfasm": "purebasic", 2131 - "purs": "purescript", 2132 1745 "py": "python", 2133 - "qs": "qsharp", 2134 - "rkt": "racket", 2135 - "razor": "cshtml", 2136 - "rpy": "renpy", 2137 - "res": "rescript", 2138 - "robot": "robotframework", 2139 1746 "rb": "ruby", 2140 1747 "sh-session": "shell-session", 2141 1748 "shellsession": "shell-session", 2142 - "smlnj": "sml", 2143 - "sol": "solidity", 2144 - "sln": "solution-file", 2145 - "rq": "sparql", 2146 - "sclang": "supercollider", 2147 - "t4": "t4-cs", 2148 - "trickle": "tremor", 2149 - "troy": "tremor", 2150 - "trig": "turtle", 2151 - "ts": "typescript", 2152 - "tsconfig": "typoscript", 2153 - "uscript": "unrealscript", 2154 - "uc": "unrealscript", 2155 1749 "url": "uri", 2156 - "vb": "visual-basic", 2157 - "vba": "visual-basic", 2158 - "webidl": "web-idl", 2159 - "mathematica": "wolfram", 2160 - "nb": "wolfram", 2161 - "wl": "wolfram", 2162 - "xeoracube": "xeora", 2163 1750 "yml": "yaml" 2164 1751 }/*]*/; 2165 1752 ··· 2585 2172 }()); 2586 2173 2587 2174 (function () { 2588 - 2589 2175 if (typeof Prism === 'undefined') { 2590 2176 return; 2591 2177 } ··· 2628 2214 var classes = env.classes; 2629 2215 2630 2216 var folderPattern = /(^|[^\\])\/\s*$/; 2631 - if (folderPattern.test(env.content)) { 2632 - // folder 2633 - 2217 + if (folderPattern.test(env.content)) { // dir 2634 2218 // remove trailing / 2635 2219 env.content = env.content.replace(folderPattern, '$1'); 2636 2220 classes.push('dir'); 2637 - } else { 2638 - // file 2639 - 2221 + } else { // file 2640 2222 // remove trailing file marker 2641 2223 env.content = env.content.replace(/(^|[^\\])[=*|]\s*$/, '$1'); 2642 - 2643 - var parts = env.content.toLowerCase().replace(/\s+/g, '').split('.'); 2644 - while (parts.length > 1) { 2645 - parts.shift(); 2646 - // Ex. 'foo.min.js' would become '<span class="token keyword ext-min-js ext-js">foo.min.js</span>' 2647 - classes.push('ext-' + parts.join('-')); 2648 - } 2649 2224 } 2650 2225 2651 2226 if (env.content[0] === '.') { ··· 2654 2229 } 2655 2230 }); 2656 2231 }()); 2657 -
+2 -1
public/prism/prism-markup.js
··· 53 53 }, 54 54 { 55 55 pattern: /^(\s*)["']|["']$/, 56 - lookbehind: true 56 + lookbehind: true, 57 + alias: 'markup-attr-quotes' 57 58 } 58 59 ] 59 60 }
+18
public/prism/prism-pwsh-functionsignature.js
··· 1 + // assumes a direct copy-paste from a cmdlet's SYNTAX help section, like 2 + /* 3 + element [[-InnerHTML] <Object>] [[-Autocomplete] {on | off}] [[-Name] 4 + <string>] [[-Rel] <string>] [[-Attributes] <hashtable>] [-NoValidate] 5 + [<CommonParameters>] 6 + */ 7 + 8 + Prism.languages['pwsh-functionsignature'] = { 9 + 'function': { 10 + // the function name will always be the first word! 11 + pattern: /^(?:\s+)?\w+ /i, 12 + }, 13 + 'parameter': { 14 + pattern: /-\w+/, 15 + alias: 'variable' 16 + }, 17 + 'punctuation': /[\[\]\(\)\{\}\<\>]/ 18 + }
+7
public/prism/prism-pwsh-mizumiya.js
··· 1 + var pz = Prism.languages['pwsh']; 2 + pz.function.push( 3 + // Import-Module Mizumiya; Get-Module Mizumiya | % ExportedCommands | % Keys | Join-String -Sep '|' 4 + // WITH element,_new_tag 5 + /\b(?:element|_new_tag|a|abbr|address|area|article|aside|AttributeEncode|audio|b|base|bdi|bdo|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|comment|datalist|datatag|dd|del|details|dfn|dialog|div|dl|doctype|dt|em|embed|fencedframe|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|HTMLEncode|i|iframe|img|input|ins|kbd|label|legend|li|link|main|map|mark|marquee|menu|meta|meter|nav|New-HTMLElement|noscript|object|ol|optgroup|option|output|p|picture|pre|progress|q|rb|rp|rt|rtc|ruby|s|samp|script|search|section|selecttag|slot|small|source|span|strong|style|sub|summary|sup|table|tbody|td|template|textarea|tfoot|th|thead|time|title|tr|track|u|ul|vartag|video|wbr)\b/i 6 + ) 7 + Prism.languages['pwsh-mizumiya'] = pz;
+152 -16
public/prism/prism-pwsh.js
··· 1 1 (function (Prism) { 2 - 3 - var powershell = Prism.languages.powershell = { 2 + var pwsh = Prism.languages.pwsh = { 3 + 'directive': [ 4 + /^using.*/m, 5 + /^#Requires/m, 6 + ], 4 7 'comment': [ 5 8 { 6 9 pattern: /(^|[^`])<#[\s\S]*?#>/, ··· 13 16 ], 14 17 'string': [ 15 18 { 19 + pattern: /@"[\s\S]*"@/i, 20 + greedy: true, 21 + inside: null // see below 22 + }, 23 + { 24 + pattern: /@'[\s\S]*'@/i, 25 + greedy: true, 26 + }, 27 + { 16 28 pattern: /"(?:`[\s\S]|[^`"])*"/, 17 - greedy: true, 29 + // greedy: true, 18 30 inside: null // see below 19 31 }, 20 32 { ··· 26 38 // Supports two levels of nested brackets (e.g. `[OutputType([System.Collections.Generic.List[int]])]`) 27 39 'namespace': /\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i, 28 40 'boolean': /\$(?:false|true)\b/i, 29 - 'variable': /\$\w+\b/, 41 + 'number': { 42 + /* 43 + (^|[^a-zA-Z0-9_]) -- (lookbehind) word boundary since \b doesn't 44 + quite work, see https://www.rexegg.com/regex-boundaries.php#real-word-boundary 45 + [-+]? -- pos/neg 46 + (?:0x)? -- hex prefix 47 + \.? -- decimal with no leading 0 (unfortunately this will also 48 + accept a string like ".0.0", but that's probably fine) 49 + \d+ -- numbers 50 + (?: 51 + (?: -- decimal: 52 + \. -- mid-number decimal separator 53 + (?:\d+)? -- numbers (optional here!) 54 + )? 55 + (?:e\+\d+)? -- exponent 56 + (?:d|l|uy|y|us|s|u|n)? -- see about_Numeric_Literals 57 + )? 58 + */ 59 + pattern: /(^|[^a-z0-9_])[-+]?(?:0x)?\.?\d+(?:(?:\.(?:\d+)?)?(?:e\+\d+)?(?:d|l|uy|y|us|s|u|n)?)?/i, 60 + lookbehind: true 61 + }, 62 + 'variable': [ 63 + /\$[\w:]+\b/, 64 + // dont match escaped brace (`}) 65 + /\${(.*(?!`}))?}/, 66 + { 67 + pattern: /(\$[\w:]+\b\.)[\w]+/, 68 + lookbehind: true 69 + } 70 + ], 30 71 // Cmdlets and aliases. Aliases should come last, otherwise "write" gets preferred over "write-host" for example 31 - // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" } 32 - // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" } 33 72 'function': [ 34 - /\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i, 35 - /\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i 73 + // (Get-Verb | % Verb)+(Get-Command | ? { $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" } | % { $_.Name.split('-')[0] }) | sort | uniq | Join-String -Separator '|' 74 + /\b(?:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i, 75 + // (Get-Alias | ? { $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" } | % name)+$winalias | sort | uniq | Join-String -Separator '|' 76 + // where $winalias is 77 + // (on Windows) `Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" } | % name` 78 + // (on Linux) `$winalias = @"<the above output pasted..." -split "`n" 79 + /\b(?:ac|cat|cd|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvfj|cvpa|cvtj|dbp|del|diff|dir|ebp|echo|epal|epcsv|erase|fc|fhx|fl|ft|fw|gal|gbp|gc|gcb|gci|gcs|gdr|gerr|gi|gin|gl|gm|gp|gps|gpv|group|gsv|gtz|gu|gv|iex|ii|ipal|ipcsv|irm|iwr|kill|ls|measure|mi|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|psmount|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|sal|saps|sasv|sbp|scb|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|stz|sv|tee|type|write)\b/i, 80 + /\b(?:\S+-\S+)\b/i, 81 + { 82 + pattern: /\b((?:function|filter|workflow) )\S+\b/i, 83 + lookbehind: true 84 + }, 85 + { 86 + /* 87 + (\.) -- (lookbehind) "." for property access 88 + \w+ -- name 89 + (?<= -- make sure this is a method call! 90 + \( 91 + ) 92 + */ 93 + pattern: /(\.)\w+(?<=\()/i, 94 + lookbehind: true 95 + }, 96 + { 97 + /* 98 + (\. |& )? -- (lookbehind) check if dot-sourcing or calling 99 + [\\/.\S]+? -- executable name including more periods 100 + \. -- extension separator 101 + (?:com|exe|bat|cmd|vbs|vbe|js|jse|ps1) -- most of Windows' $env:PATHEXT 102 + */ 103 + pattern: /(\. |& )?[\\/.\S]+?\.(?:com|exe|bat|cmd|vbs|vbe|js|jse|ps1)/i, 104 + lookbehind: true 105 + } 36 106 ], 37 - // per http://technet.microsoft.com/en-us/library/hh847744.aspx 38 - 'keyword': /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i, 107 + 'parameter': { 108 + pattern: /-{1,2}\S+/, 109 + alias: 'variable', 110 + lookbehind: true 111 + }, 39 112 'operator': { 40 - pattern: /(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i, 113 + /* 114 + (^|\W) -- (lookbehind) check if at a valid start point 115 + (?: 116 + ! -- alternate not operator 117 + | 118 + - -- operator "flag" 119 + (?: 120 + b? -- binary? 121 + (?:and|x?or|not) 122 + | 123 + [ci]? -- c(ase sensitive) and i(nsensitive) 124 + (?:gt|ge|lt|le|eq|ne) 125 + 126 + | 127 + [ci]? 128 + (?:not)? 129 + (?:contains|in|like|match) 130 + | 131 + as|is(?:not)?|join|replace|sh[lr] 132 + ) 133 + \b 134 + | 135 + -- minus, decrement, and minus-equals 136 + -[-=]? 137 + | 138 + -- add, incremement, plus-equals 139 + \+[+=]? 140 + | 141 + -- mult/div/mod and their x-equals 142 + [*\/%]=? 143 + | 144 + -- file redirection: send (>) and append (>>) 145 + >>? 146 + | 147 + -- stream redirection: pwsh has 6 streams, which can either be 148 + redirected (>>?) or send to stream 1 (the only valid stream- 149 + to-stream redirection). see about_Redirection 150 + CURRENTLY BROKEN, OVERRIDEN BY number 151 + [*1-6](?:>&1|>>?) 152 + ) 153 + */ 154 + pattern: /(^|\W)(?:!|-(?:b?(?:and|x?or|not)|as|[ci]?(?:gt|ge|lt|le|eq|ne)|[ci]?(?:not)?(?:contains|in|like|match)|is(?:not)?|join|replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?|>>?|[*1-6](?:>&1|>>?))/i, 41 155 lookbehind: true 42 156 }, 157 + // per http://technet.microsoft.com/en-us/library/hh847744.aspx 158 + 'keyword': /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i, 43 159 'punctuation': /[|{}[\];(),.]/ 44 160 }; 45 161 46 162 // Variable interpolation inside strings, and nested expressions 47 - powershell.string[0].inside = { 163 + var inner = { 48 164 'function': { 49 165 // Allow for one level of nesting 50 - pattern: /(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/, 166 + /* 167 + (^|[^`]) -- (lookbehind) start of string but not at an escape character 168 + \$\( -- start subshell $( 169 + (?: 170 + \$\([^\r\n()]*\) -- more subshells 171 + | 172 + (?! 173 + \$\( -- not another subshell (see above) 174 + ) 175 + [^\r\n)] -- greedy match to the end of the subshell 176 + )* 177 + \) 178 + */ 179 + // pattern: /(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/, 180 + // this seems to fix the string interpolation but will probably 181 + // break more things 182 + pattern: /(^|[^`])\$\(.*\)/s, 51 183 lookbehind: true, 52 - inside: powershell 184 + greedy: true, 185 + inside: pwsh 53 186 }, 54 - 'boolean': powershell.boolean, 55 - 'variable': powershell.variable, 187 + 'boolean': pwsh.boolean, 188 + 'variable': pwsh.variable, 56 189 }; 190 + 191 + pwsh.string[0].inside = inner; 192 + pwsh.string[2].inside = inner; 57 193 58 194 }(Prism));