Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(theme-common): fix missing code block MagicComments style in Visual Basic (.NET) 16 #9727

Merged
merged 5 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const commentPatterns = {
wasm: {start: '\\;\\;', end: ''},
tex: {start: '%', end: ''},
vb: {start: "['‘’]", end: ''},
vbnet: {start: "(?:_\\s*)?['‘’]", end: ''}, // Visual Studio 2019 or later
rem: {start: '[Rr][Ee][Mm]\\b', end: ''},
f90: {start: '!', end: ''}, // Free format only
ml: {start: '\\(\\*', end: '\\*\\)'},
Expand Down Expand Up @@ -113,10 +114,11 @@ function getAllMagicCommentDirectiveStyles(
return getCommentPattern(['wasm'], magicCommentDirectives);

case 'vb':
case 'vbnet':
case 'vba':
case 'visual-basic':
return getCommentPattern(['vb', 'rem'], magicCommentDirectives);
case 'vbnet':
return getCommentPattern(['vbnet', 'rem'], magicCommentDirectives);

case 'batch':
return getCommentPattern(['rem'], magicCommentDirectives);
Expand Down
24 changes: 20 additions & 4 deletions website/_dogfooding/_pages tests/code-block-tests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,32 @@ y = times2(x);
\end{document}
```

```vbnet title="vbnet.vb"
Dim languages As New Set(Of String) From {
```vba title="vba.vb"
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
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#",
"Visual Basic",
_ ' highlight-start
"F#",
' highlight-end
"PowerShell",
' highlight-next-line
"TypeScript"
_' highlight-end
}
```

Expand Down