Skip to content

Commit

Permalink
🎨 Write class name to admonition (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 authored Feb 12, 2024
1 parent 227326a commit 21d6dce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-cycles-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-to-react': patch
---

Include user-specified classnames for admonitions
4 changes: 4 additions & 0 deletions packages/myst-to-react/src/admonitions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export function Admonition({
dropdown,
children,
hideIcon,
className,
}: {
title?: React.ReactNode;
color?: Color;
Expand All @@ -158,6 +159,7 @@ export function Admonition({
simple?: boolean;
dropdown?: boolean;
hideIcon?: boolean;
className?: string;
}) {
return (
<WrapperElement
Expand All @@ -174,6 +176,7 @@ export function Admonition({
'border-amber-600': color === 'yellow',
'border-red-600': color === 'red',
},
className,
)}
>
{title && (
Expand Down Expand Up @@ -247,6 +250,7 @@ export const AdmonitionRenderer: NodeRenderer<AdmonitionSpec> = ({ node }) => {
dropdown={isDropdown}
simple={isSimple}
hideIcon={hideIcon}
className={classNames(classes)}
>
{useTitle ? <MyST ast={rest} /> : <MyST ast={node.children} />}
</Admonition>
Expand Down

0 comments on commit 21d6dce

Please sign in to comment.