Skip to content

Commit

Permalink
fix: trimEnd to code in highlighter, close #29 (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu authored Sep 11, 2023
1 parent d9a1874 commit ffc7a93
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 1 addition & 1 deletion src/runtime/shiki/highlighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const useShikiHighlighter = createSingleton((opts?: any) => {
await highlighter.loadLanguage(lang)
}

const root = highlighter.codeToHast(code, {
const root = highlighter.codeToHast(code.trimEnd(), {
lang,
themes: themesObject,
defaultColor: 'default',
Expand Down
9 changes: 0 additions & 9 deletions test/markdown/code-block-highlighted.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,6 @@ it('Highlighted code block', async () => {
"tag": "span",
"type": "element",
},
{
"children": [],
"props": {
"class": "line",
"line": 4,
},
"tag": "span",
"type": "element",
},
],
"props": {
"__ignoreMap": "",
Expand Down

0 comments on commit ffc7a93

Please sign in to comment.