Skip to content

Commit caec5e3

Browse files
Added support for XML doc in C#, F#, and VB.net (#2340)
1 parent 1946918 commit caec5e3

File tree

12 files changed

+261
-3
lines changed

12 files changed

+261
-3
lines changed

components.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,12 @@
11451145
},
11461146
"owner": "freakmaxi"
11471147
},
1148+
"xml-doc": {
1149+
"title": "XML doc (.net)",
1150+
"require": "markup",
1151+
"modify": ["csharp", "fsharp", "vbnet"],
1152+
"owner": "RunDevelopment"
1153+
},
11481154
"xojo": {
11491155
"title": "Xojo (REALbasic)",
11501156
"owner": "Golmote"

components/prism-xml-doc.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
(function (Prism) {
2+
3+
/**
4+
* If the given language is present, it will insert the given doc comment grammar token into it.
5+
*
6+
* @param {string} lang
7+
* @param {any} docComment
8+
*/
9+
function insertDocComment(lang, docComment) {
10+
if (Prism.languages[lang]) {
11+
Prism.languages.insertBefore(lang, 'comment', {
12+
'doc-comment': docComment
13+
});
14+
}
15+
}
16+
17+
var tag = Prism.languages.markup.tag;
18+
19+
var slashDocComment = {
20+
pattern: /\/\/\/.*/,
21+
greedy: true,
22+
alias: 'comment',
23+
inside: {
24+
'tag': tag
25+
}
26+
};
27+
var tickDocComment = {
28+
pattern: /'''.*/,
29+
greedy: true,
30+
alias: 'comment',
31+
inside: {
32+
'tag': tag
33+
}
34+
};
35+
36+
insertDocComment('csharp', slashDocComment);
37+
insertDocComment('fsharp', slashDocComment);
38+
insertDocComment('vbnet', tickDocComment);
39+
40+
}(Prism));

components/prism-xml-doc.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-xml-doc.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<h2>C#</h2>
2+
<pre><code class="language-csharp">/// &lt;summary>
3+
/// Summary documentation goes here.
4+
/// &lt;/summary></code></pre>
5+
6+
<h2>F#</h2>
7+
<pre><code class="language-fsharp">/// &lt;summary>
8+
/// Summary documentation goes here.
9+
/// &lt;/summary></code></pre>
10+
11+
<h2>VB.net</h2>
12+
<pre><code class="language-vbnet">''' &lt;summary>
13+
''' Summary documentation goes here.
14+
''' &lt;/summary></code></pre>

plugins/autoloader/prism-autoloader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"velocity": "markup",
142142
"wiki": "markup",
143143
"xeora": "markup",
144+
"xml-doc": "markup",
144145
"xquery": "markup"
145146
}/*]*/;
146147

plugins/autoloader/prism-autoloader.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/show-language/prism-show-language.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
"wasm": "WebAssembly",
180180
"wiki": "Wiki markup",
181181
"xeoracube": "XeoraCube",
182+
"xml-doc": "XML doc (.net)",
182183
"xojo": "Xojo (REALbasic)",
183184
"xquery": "XQuery",
184185
"yaml": "YAML",

plugins/show-language/prism-show-language.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/// <summary>
2+
/// Class level summary documentation goes here.
3+
/// </summary>
4+
/// <remarks>
5+
/// Longer comments can be associated with a type or member through
6+
/// the remarks tag.
7+
/// </remarks>
8+
9+
----------------------------------------------------
10+
11+
[
12+
["doc-comment", [
13+
"/// ",
14+
["tag", [
15+
["tag", [
16+
["punctuation", "<"],
17+
"summary"
18+
]],
19+
["punctuation", ">"]
20+
]]
21+
]],
22+
["doc-comment", [
23+
"/// Class level summary documentation goes here."
24+
]],
25+
["doc-comment", [
26+
"/// ",
27+
["tag", [
28+
["tag", [
29+
["punctuation", "</"],
30+
"summary"
31+
]],
32+
["punctuation", ">"]
33+
]]
34+
]],
35+
["doc-comment", [
36+
"/// ",
37+
["tag", [
38+
["tag", [
39+
["punctuation", "<"],
40+
"remarks"
41+
]],
42+
["punctuation", ">"]
43+
]]
44+
]],
45+
["doc-comment", [
46+
"/// Longer comments can be associated with a type or member through"
47+
]],
48+
["doc-comment", [
49+
"/// the remarks tag."
50+
]],
51+
["doc-comment", [
52+
"/// ",
53+
["tag", [
54+
["tag", [
55+
["punctuation", "</"],
56+
"remarks"
57+
]],
58+
["punctuation", ">"]
59+
]]
60+
]]
61+
]
62+
63+
----------------------------------------------------
64+
65+
Checks for XML documentation comments.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy