Skip to content

Commit

Permalink
Merge branch 'beta' into feat/throw
Browse files Browse the repository at this point in the history
  • Loading branch information
kellyjosephprice committed Mar 28, 2024
2 parents c7365cd + 4dd3425 commit 3dfc2bd
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 14 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Changelog
===

## Version 6.75.0-beta.15

### ✨ New & Improved

* rename react ot compile ([#843](https://github.com/readmeio/markdown/issues/843)) ([52111ce](https://github.com/readmeio/markdown/commit/52111cef8482c18e1ec3be333f71d90f46284b4d))

## Version 6.75.0-beta.14

### 🛠 Fixes & Updates

* callout headings ([#842](https://github.com/readmeio/markdown/issues/842)) ([da78ea2](https://github.com/readmeio/markdown/commit/da78ea2f7d868b71a277ed9f7e902324c0c4a6ad))

## Version 6.75.0-beta.13

### ✨ New & Improved
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions components/Callout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface Props extends React.PropsWithChildren<React.HTMLAttributes<HTMLQuoteEl
}

const Callout = (props: Props) => {
const { attributes, theme, icon, heading } = props;
const { attributes, children, theme, icon, heading } = props;

return (
// @ts-ignore
Expand All @@ -19,7 +19,7 @@ const Callout = (props: Props) => {
{heading}
</h3>
)}
{props.children}
{children}
</blockquote>
);
};
Expand Down
2 changes: 1 addition & 1 deletion example/Doc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Doc = () => {
safeMode: searchParams.has('safeMode'),
};

const Content = mdx.run(String(mdx.react(doc, opts)));
const Content = mdx.run(String(mdx.compile(doc, opts)));

return (
<React.Fragment>
Expand Down
2 changes: 1 addition & 1 deletion index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const reactProcessor = (opts = {}) => {
return createProcessor({ remarkPlugins: [calloutTransformer], ...opts });
};

export const react = (text: string, opts = {}) => {
export const compile = (text: string, opts = {}) => {
return String(
compileSync(text, {
outputFormat: 'function-body',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@readme/markdown",
"description": "ReadMe's React-based Markdown parser",
"author": "Rafe Goldberg <[email protected]>",
"version": "6.75.0-beta.13",
"version": "6.75.0-beta.15",
"main": "dist/main.node.js",
"types": "dist/index.d.ts",
"browser": "dist/main.js",
Expand Down
11 changes: 4 additions & 7 deletions processor/transform/callouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,17 @@ const calloutTransformer = () => {

if (icon && match) {
const heading = startText.slice(match.length);
const body = toString({ type: 'root', children: node.children.slice(1) } as Node);
const data = {

node.children.shift();
node.type = 'rdme-callout';
node.data = {
hName: 'Callout',
hProperties: {
heading,
value: body,
icon,
theme: themes[icon] || 'default',
},
};

node.type = 'rdme-callout';
node.data = data;
node.children[0].children[0].value = startText.slice(match.length);
}
} catch (e) {
console.log(e);
Expand Down

0 comments on commit 3dfc2bd

Please sign in to comment.