0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

Bugfix/extra whitespace in code (#12570)

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
This commit is contained in:
Sean van Zuidam 2024-12-05 15:50:17 +01:00 committed by GitHub
parent a5b17359c1
commit 87231b1168
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
"@astrojs/markdown-remark": patch
---
Removes trailing new line in code blocks to prevent generating a trailing empty `<span />` tag

View file

@ -103,6 +103,8 @@ export async function createShikiHighlighter({
} }
} }
code = code.replace(/(?:\r\n|\r|\n)$/, '');
const themeOptions = Object.values(themes).length ? { themes } : { theme }; const themeOptions = Object.values(themes).length ? { themes } : { theme };
const inline = options?.inline ?? false; const inline = options?.inline ?? false;