Skip to content

Commit

Permalink
fix: GithubCodeBlock 在 windows 和 linux 下编译有不同的表现
Browse files Browse the repository at this point in the history
  • Loading branch information
IceOfSummer committed Sep 23, 2024
1 parent b8ada51 commit 8cebdb6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ exports[`Test mdx render 1`] = `
<p>CAUTION</p>
</blockquote>
<blockquote><div class="flex items-center mt-4"><svg width="15" height="15"><use xlink:href="#icon-info"></use></svg><span class="ml-2">Note</span></div>
<p>ee
<p> eee
hello world
[!NOTE]</p>
</blockquote>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ function resolveAndRemoveType(props: MdxProps): [React.ReactNode, GithubCodeBloc
const copiedParagraph = { ...paragraph }
copiedRoot[1] = copiedParagraph

let begin = paragraph.props.children.substring(matched[0].length)
if (begin.startsWith(os.EOL)) {
begin = begin.substring(os.EOL.length)
}
copiedParagraph.props = {
children: paragraph.props.children.substring(3 + os.EOL.length + matched[1].length)
children: begin
}

return [copiedRoot, attr]
Expand Down

0 comments on commit 8cebdb6

Please sign in to comment.