Skip to content

Commit

Permalink
fix(mdx-loader): use PascalCase for MDXAdmonitionTitle placeholder el…
Browse files Browse the repository at this point in the history
…ement
  • Loading branch information
Josh-Cena committed Oct 25, 2022
1 parent 006d440 commit 037606a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Expand Up @@ -51,7 +51,7 @@ exports[`admonitions remark plugin default behavior for custom keyword 1`] = `

exports[`admonitions remark plugin interpolation 1`] = `
"<p>Test admonition with interpolated title/body</p>
<admonition type="tip"><mdxAdmonitionTitle>My <code>interpolated</code> <strong>title</strong> &#x3C;button style={{color: "red"}} onClick={() => alert("click")}>test</mdxAdmonitionTitle><p><code>body</code> <strong>interpolated</strong> content</p></admonition>"
<admonition type="tip"><MDXAdmonitionTitle>My <code>interpolated</code> <strong>title</strong> &#x3C;button style={{color: "red"}} onClick={() => alert("click")}>test</MDXAdmonitionTitle><p><code>body</code> <strong>interpolated</strong> content</p></admonition>"
`;

exports[`admonitions remark plugin replace custom keyword 1`] = `
Expand Down
Expand Up @@ -149,7 +149,9 @@ const plugin: Plugin = function plugin(
!isSimpleTextTitle && {
type: admonitionNodeType,
data: {
hName: 'mdxAdmonitionTitle',
// Use PascalCase, because it's a custom element replaced in
// client code, not Remark code, so we have to make React happy
hName: 'MDXAdmonitionTitle',
hProperties: {},
},
children: titleNodes,
Expand Down
Expand Up @@ -18,7 +18,7 @@ function extractMDXAdmonitionTitle(children: ReactNode): {
(item) =>
React.isValidElement(item) &&
(item.props as {mdxType: string} | null)?.mdxType ===
'mdxAdmonitionTitle',
'MDXAdmonitionTitle',
);
const rest = <>{items.filter((item) => item !== mdxAdmonitionTitle)}</>;
return {
Expand Down

0 comments on commit 037606a

Please sign in to comment.