Skip to content

Commit

Permalink
Bugfix/extra whitespace in code (#12570)
Browse files Browse the repository at this point in the history
Co-authored-by: Bjorn Lu <[email protected]>
  • Loading branch information
GrimLink and bluwy authored Dec 5, 2024
1 parent a5b1735 commit 87231b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-pens-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/markdown-remark": patch
---

Removes trailing new line in code blocks to prevent generating a trailing empty `<span />` tag
2 changes: 2 additions & 0 deletions packages/markdown/remark/src/shiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ export async function createShikiHighlighter({
}
}

code = code.replace(/(?:\r\n|\r|\n)$/, '');

const themeOptions = Object.values(themes).length ? { themes } : { theme };
const inline = options?.inline ?? false;

Expand Down

0 comments on commit 87231b1

Please sign in to comment.