ISO-Share/node_modules/prismjs/components/prism-xml-doc.js

41 lines
781 B
JavaScript
Raw Permalink Normal View History

2024-11-26 21:16:11 +01:00
(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));