aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-xml-doc.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/prism/prism-xml-doc.js')
-rw-r--r--public/prism/prism-xml-doc.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/public/prism/prism-xml-doc.js b/public/prism/prism-xml-doc.js
new file mode 100644
index 0000000..42e809d
--- /dev/null
+++ b/public/prism/prism-xml-doc.js
@@ -0,0 +1,38 @@
+(function (Prism) {
+ /**
+ * If the given language is present, it will insert the given doc comment grammar token into it.
+ *
+ * @param {string} lang
+ * @param {any} docComment
+ */
+ function insertDocComment(lang, docComment) {
+ if (Prism.languages[lang]) {
+ Prism.languages.insertBefore(lang, 'comment', {
+ 'doc-comment': docComment,
+ });
+ }
+ }
+
+ var tag = Prism.languages.markup.tag;
+
+ var slashDocComment = {
+ pattern: /\/\/\/.*/,
+ greedy: true,
+ alias: 'comment',
+ inside: {
+ tag: tag,
+ },
+ };
+ var tickDocComment = {
+ pattern: /'''.*/,
+ greedy: true,
+ alias: 'comment',
+ inside: {
+ tag: tag,
+ },
+ };
+
+ insertDocComment('csharp', slashDocComment);
+ insertDocComment('fsharp', slashDocComment);
+ insertDocComment('vbnet', tickDocComment);
+})(Prism);