mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-03 04:07:32 +02:00
fix(theme-common): fix missing code block MagicComments style in Visual Basic (.NET) 16 (#9727)
This commit is contained in:
parent
141e360a83
commit
f55aad181f
2 changed files with 23 additions and 5 deletions
|
@ -28,6 +28,7 @@ const commentPatterns = {
|
||||||
wasm: {start: '\\;\\;', end: ''},
|
wasm: {start: '\\;\\;', end: ''},
|
||||||
tex: {start: '%', end: ''},
|
tex: {start: '%', end: ''},
|
||||||
vb: {start: "['‘’]", end: ''},
|
vb: {start: "['‘’]", end: ''},
|
||||||
|
vbnet: {start: "(?:_\\s*)?['‘’]", end: ''}, // Visual Studio 2019 or later
|
||||||
rem: {start: '[Rr][Ee][Mm]\\b', end: ''},
|
rem: {start: '[Rr][Ee][Mm]\\b', end: ''},
|
||||||
f90: {start: '!', end: ''}, // Free format only
|
f90: {start: '!', end: ''}, // Free format only
|
||||||
ml: {start: '\\(\\*', end: '\\*\\)'},
|
ml: {start: '\\(\\*', end: '\\*\\)'},
|
||||||
|
@ -113,10 +114,11 @@ function getAllMagicCommentDirectiveStyles(
|
||||||
return getCommentPattern(['wasm'], magicCommentDirectives);
|
return getCommentPattern(['wasm'], magicCommentDirectives);
|
||||||
|
|
||||||
case 'vb':
|
case 'vb':
|
||||||
case 'vbnet':
|
|
||||||
case 'vba':
|
case 'vba':
|
||||||
case 'visual-basic':
|
case 'visual-basic':
|
||||||
return getCommentPattern(['vb', 'rem'], magicCommentDirectives);
|
return getCommentPattern(['vb', 'rem'], magicCommentDirectives);
|
||||||
|
case 'vbnet':
|
||||||
|
return getCommentPattern(['vbnet', 'rem'], magicCommentDirectives);
|
||||||
|
|
||||||
case 'batch':
|
case 'batch':
|
||||||
return getCommentPattern(['rem'], magicCommentDirectives);
|
return getCommentPattern(['rem'], magicCommentDirectives);
|
||||||
|
|
|
@ -384,16 +384,32 @@ y = times2(x);
|
||||||
\end{document}
|
\end{document}
|
||||||
```
|
```
|
||||||
|
|
||||||
```vbnet title="vbnet.vb"
|
```vba title="vba.vb"
|
||||||
Dim languages As New Set(Of String) From {
|
Function Factorial(ByVal n As Long) As Long
|
||||||
|
If n < 0 Then
|
||||||
|
Err.Raise 5 ' Invalid argument
|
||||||
|
End If
|
||||||
|
'highlight-next-line
|
||||||
|
Factorial = 1 ' return value
|
||||||
|
Dim i As Long
|
||||||
' highlight-start
|
' highlight-start
|
||||||
|
For i = 2 To n
|
||||||
|
Factorial = Factorial * i
|
||||||
|
Next
|
||||||
|
' highlight-end
|
||||||
|
End Function
|
||||||
|
```
|
||||||
|
|
||||||
|
```vbnet title="vbnet.vb"
|
||||||
|
' highlight-next-line
|
||||||
|
Dim languages As New HashSet(Of String) From {
|
||||||
"C#",
|
"C#",
|
||||||
"Visual Basic",
|
"Visual Basic",
|
||||||
|
_ ' highlight-start
|
||||||
"F#",
|
"F#",
|
||||||
' highlight-end
|
|
||||||
"PowerShell",
|
"PowerShell",
|
||||||
' highlight-next-line
|
|
||||||
"TypeScript"
|
"TypeScript"
|
||||||
|
_' highlight-end
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue