-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
xml-doc.js
44 lines (43 loc) · 1.09 KB
/
xml-doc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// @ts-nocheck
import refractorMarkup from './markup.js'
xmlDoc.displayName = 'xml-doc'
xmlDoc.aliases = []
/** @type {import('../core.js').Syntax} */
export default function xmlDoc(Prism) {
Prism.register(refractorMarkup)
;(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)
}