Skip to content

Commit

Permalink
fix: types (#877)
Browse files Browse the repository at this point in the history
| [![PR App][icn]][demo] |
| :--------------------: |

## 🧰 Changes

Fixes a bunch of types from the jsx-coercion PR.

## 🧬 QA & Testing

- [Broken on production][prod].
- [Working in this PR app][demo].

[demo]: https://markdown-pr-PR_NUMBER.herokuapp.com
[prod]: https://SUBDOMAIN.readme.io
[icn]:
https://user-images.githubusercontent.com/886627/160426047-1bee9488-305a-4145-bb2b-09d8b757d38a.svg
  • Loading branch information
kellyjosephprice authored May 17, 2024
1 parent b742c6c commit c0a4d66
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 251 deletions.
1 change: 1 addition & 0 deletions enums.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum NodeTypes {
callout = 'callout',
codeTabs = 'code-tabs',
emoji = 'emoji',
i = 'i',
Expand Down
6 changes: 3 additions & 3 deletions index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type RunOpts = Omit<RunOptions, 'Fragment'> & {
};

type MdastOpts = {
components?: ComponentOpts;
components?: Record<string, string>;
};

export { Components };
Expand Down Expand Up @@ -112,12 +112,12 @@ export const html = (text: string, opts = {}) => {
unimplemented('html export');
};

const astProcessor = (opts = {}) =>
const astProcessor = (opts: MdastOpts = { components: {} }) =>
remark()
.use(remarkMdx)
.use(remarkFrontmatter)
.use(remarkPlugins)
.use(readmeComponentsTransformer, { components: opts.components });
.use(readmeComponentsTransformer({ components: opts.components }));

export const mdast: any = (text: string, opts: MdastOpts = {}) => {
const processor = astProcessor(opts);
Expand Down
180 changes: 13 additions & 167 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"trim": "^1.0.1",
"unified": "^8.4.0",
"unist-util-flatmap": "^1.0.0",
"unist-util-visit": "^4.1.1",
"unist-util-visit": "^5.0.0",
"util": "^0.12.5"
},
"peerDependencies": {
Expand Down Expand Up @@ -85,6 +85,7 @@
"@types/jest": "^29.5.12",
"@types/mdast": "^4.0.3",
"@types/mdx": "^2.0.12",
"@types/unist": "^3.0.2",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/ui": "^1.6.0",
"babel-jest": "^29.5.0",
Expand Down
Loading

0 comments on commit c0a4d66

Please sign in to comment.