forked from PrismJS/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for XML doc in C#, F#, and VB.net (PrismJS#2340)
- Loading branch information
1 parent
a9fbc10
commit 7892ff8
Showing
12 changed files
with
261 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(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)); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<h2>C#</h2> | ||
<pre><code class="language-csharp">/// <summary> | ||
/// Summary documentation goes here. | ||
/// </summary></code></pre> | ||
|
||
<h2>F#</h2> | ||
<pre><code class="language-fsharp">/// <summary> | ||
/// Summary documentation goes here. | ||
/// </summary></code></pre> | ||
|
||
<h2>VB.net</h2> | ||
<pre><code class="language-vbnet">''' <summary> | ||
''' Summary documentation goes here. | ||
''' </summary></code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/// <summary> | ||
/// Class level summary documentation goes here. | ||
/// </summary> | ||
/// <remarks> | ||
/// Longer comments can be associated with a type or member through | ||
/// the remarks tag. | ||
/// </remarks> | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["doc-comment", [ | ||
"/// ", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "<"], | ||
"summary" | ||
]], | ||
["punctuation", ">"] | ||
]] | ||
]], | ||
["doc-comment", [ | ||
"/// Class level summary documentation goes here." | ||
]], | ||
["doc-comment", [ | ||
"/// ", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "</"], | ||
"summary" | ||
]], | ||
["punctuation", ">"] | ||
]] | ||
]], | ||
["doc-comment", [ | ||
"/// ", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "<"], | ||
"remarks" | ||
]], | ||
["punctuation", ">"] | ||
]] | ||
]], | ||
["doc-comment", [ | ||
"/// Longer comments can be associated with a type or member through" | ||
]], | ||
["doc-comment", [ | ||
"/// the remarks tag." | ||
]], | ||
["doc-comment", [ | ||
"/// ", | ||
["tag", [ | ||
["tag", [ | ||
["punctuation", "</"], | ||
"remarks" | ||
]], | ||
["punctuation", ">"] | ||
]] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for XML documentation comments. |
Oops, something went wrong.