Skip to content

Commit

Permalink
fix: Exclude code snippets with injects from formatting (#10806)
Browse files Browse the repository at this point in the history
  • Loading branch information
chargome authored Jul 24, 2024
1 parent 12dd357 commit 2dc857d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/remark-format-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ export default function remarkFormatCodeBlocks() {
// skip code blocks with diff meta as they might have
// broken syntax due to + and - characters
// or with `onboardingOptions` as they need to have predictable line numbers
// or `@inject` statements as they often lead to unnecessary line breaks
.filter(
node => !(node.meta?.includes('diff') || node.meta?.includes('onboardingOptions'))
node =>
!(
node.meta?.includes('diff') ||
node.meta?.includes('onboardingOptions') ||
node.value?.includes('@inject packages')
)
)
.map(node => formatCode(node));

Expand Down

0 comments on commit 2dc857d

Please sign in to comment.