diff --git a/.changeset/tidy-ducks-breathe.md b/.changeset/tidy-ducks-breathe.md new file mode 100644 index 000000000..f84996ffa --- /dev/null +++ b/.changeset/tidy-ducks-breathe.md @@ -0,0 +1,7 @@ +--- +'@myst-theme/diagrams': patch +'myst-demo': patch +'myst-to-react': patch +--- + +Add more support for class and identifier diff --git a/packages/diagrams/src/index.tsx b/packages/diagrams/src/index.tsx index af3819440..965774995 100644 --- a/packages/diagrams/src/index.tsx +++ b/packages/diagrams/src/index.tsx @@ -10,7 +10,15 @@ async function parse(id: string, text: string): Promise { }); } -export function MermaidRenderer({ id, value }: { value: string; id: string }) { +export function MermaidRenderer({ + id, + value, + className, +}: { + value: string; + id: string; + className?: string; +}) { const key = useId(); const [graph, setGraph] = useState(); const [error, setError] = useState(); @@ -26,7 +34,7 @@ export function MermaidRenderer({ id, value }: { value: string; id: string }) { }); }, []); return ( -
+
{graph &&
} {error && (
@@ -42,5 +50,11 @@ export function MermaidRenderer({ id, value }: { value: string; id: string }) {
 }
 
 export const MermaidNodeRenderer: NodeRenderer = ({ node }) => {
-  return ;
+  return (
+    
+  );
 };
diff --git a/packages/myst-demo/src/index.tsx b/packages/myst-demo/src/index.tsx
index 13b5e4800..75bd5646b 100644
--- a/packages/myst-demo/src/index.tsx
+++ b/packages/myst-demo/src/index.tsx
@@ -231,6 +231,7 @@ async function parse(
 }
 
 export function MySTRenderer({
+  id,
   value,
   column,
   fullscreen,
@@ -239,6 +240,7 @@ export function MySTRenderer({
   captureTab,
   className,
 }: {
+  id?: string;
   value: string;
   column?: boolean;
   fullscreen?: boolean;
@@ -390,6 +392,7 @@ export function MySTRenderer({
 
   return (
     
{ - return ; + return ( + + ); }; diff --git a/packages/myst-to-react/src/basic.tsx b/packages/myst-to-react/src/basic.tsx index e6632d632..cdfaec93a 100644 --- a/packages/myst-to-react/src/basic.tsx +++ b/packages/myst-to-react/src/basic.tsx @@ -50,6 +50,10 @@ type Include = { type: 'include'; }; +type Glossary = { + type: 'glossary'; +}; + type BasicNodeRenderers = { text: NodeRenderer; span: NodeRenderer; @@ -90,6 +94,7 @@ type BasicNodeRenderers = { definitionTerm: NodeRenderer; definitionDescription: NodeRenderer; include: NodeRenderer; + glossary: NodeRenderer; }; const BASIC_RENDERERS: BasicNodeRenderers = { @@ -344,7 +349,7 @@ const BASIC_RENDERERS: BasicNodeRenderers = { }, definitionList({ node }) { return ( -
+
); @@ -355,7 +360,7 @@ const BASIC_RENDERERS: BasicNodeRenderers = { node.children?.reduce((allowed, n) => allowed && allowedStrongTypes.has(n.type), true) ?? false; return ( -
+
{makeStrong ? ( @@ -384,6 +389,14 @@ const BASIC_RENDERERS: BasicNodeRenderers = { // TODO, provider could give context about the filename return ; }, + glossary({ node }) { + // TODO, provider could give context about the filename + return ( +
+ +
+ ); + }, }; export default BASIC_RENDERERS; diff --git a/packages/myst-to-react/src/dropdown.tsx b/packages/myst-to-react/src/dropdown.tsx index a21afa272..f1546a17b 100644 --- a/packages/myst-to-react/src/dropdown.tsx +++ b/packages/myst-to-react/src/dropdown.tsx @@ -22,16 +22,19 @@ export function Details({ title, children, open, + className, }: { title: React.ReactNode; children: React.ReactNode; open?: boolean; + className?: string; }) { return (
@@ -61,7 +64,7 @@ export function Details({ export const DetailsRenderer: NodeRenderer = ({ node }) => { const [title, ...rest] = node.children as any[]; return ( -
} open={node.open}> +
} open={node.open} className={node.class}>
);