Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 2367202

Browse files
committed
fix(plugins/plugin-client-common): improvements for markdown tip parsing
Consecutive tips, where the title has structured content, are swallowed into the prior tip, i.e. we aren't starting a new tip.
1 parent 15c8bd7 commit 2367202

File tree

1 file changed

+3
-3
lines changed
  • plugins/plugin-client-common/src/components/Content/Markdown/rehype-tip

1 file changed

+3
-3
lines changed

plugins/plugin-client-common/src/components/Content/Markdown/rehype-tip/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default function plugin(/* options */) {
4949
child.children = process(child.children)
5050
} else if (child.type === 'element' && child.tagName === 'p') {
5151
if (child.children.length > 0) {
52-
if (currentTip && (child.children[0].type !== 'text' || !RE_TIP.test(child.children[0].value))) {
52+
if (currentTip && (child.children[0].type !== 'text' || !RE_TIP_START.test(child.children[0].value))) {
5353
// a new paragraph that doesn't start a new tab; add to current tab
5454
return addToTip(child)
5555
}
@@ -88,8 +88,6 @@ export default function plugin(/* options */) {
8888
position: child.position
8989
}
9090
return pnewChildren
91-
} else if (currentTip) {
92-
return addToTip(pchild)
9391
} else {
9492
const startMatch = pchild.value.match(RE_TIP_START)
9593
if (startMatch) {
@@ -106,6 +104,8 @@ export default function plugin(/* options */) {
106104
children: [],
107105
position: child.position
108106
}
107+
} else if (currentTip) {
108+
return addToTip(pchild)
109109
}
110110
}
111111
} else if (currentTip) {

0 commit comments

Comments
 (0)