From a98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Thu, 30 Dec 2021 19:47:21 +0100 Subject: chore: add prismjs for syntax highlighting --- public/prism/prism-phpdoc.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 public/prism/prism-phpdoc.js (limited to 'public/prism/prism-phpdoc.js') diff --git a/public/prism/prism-phpdoc.js b/public/prism/prism-phpdoc.js new file mode 100644 index 0000000..fd498f1 --- /dev/null +++ b/public/prism/prism-phpdoc.js @@ -0,0 +1,33 @@ +(function (Prism) { + var typeExpression = /(?:\b[a-zA-Z]\w*|[|\\[\]])+/.source; + + Prism.languages.phpdoc = Prism.languages.extend('javadoclike', { + parameter: { + pattern: RegExp( + '(@(?:global|param|property(?:-read|-write)?|var)\\s+(?:' + + typeExpression + + '\\s+)?)\\$\\w+' + ), + lookbehind: true, + }, + }); + + Prism.languages.insertBefore('phpdoc', 'keyword', { + 'class-name': [ + { + pattern: RegExp( + '(@(?:global|package|param|property(?:-read|-write)?|return|subpackage|throws|var)\\s+)' + + typeExpression + ), + lookbehind: true, + inside: { + keyword: + /\b(?:array|bool|boolean|callback|double|false|float|int|integer|mixed|null|object|resource|self|string|true|void)\b/, + punctuation: /[|\\[\]()]/, + }, + }, + ], + }); + + Prism.languages.javadoclike.addSupport('php', Prism.languages.phpdoc); +})(Prism); -- cgit v1.2.3