Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information
kellyjosephprice committed May 23, 2024
commit 2b2f1a5c911067b48a9a6ff04d626dd258ce567c
2 changes: 1 addition & 1 deletion example/Doc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const mdxComponents = {

const components = {};
Object.keys(mdxComponents).forEach(async comp => {
components[comp] = await mdx.run(mdx.compile(comp));
components[comp] = (await mdx.run(mdx.compile(comp))).default;
});

const terms = [
Expand Down
2 changes: 1 addition & 1 deletion index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const run = async (stringOrFile: string | VFileWithToc, _opts: RunOpts =
};

export const mdx = (tree: any, { hast = false, ...opts } = {}) => {
console.log(JSON.stringify({ tree, hast }, null, 2));
console.log(JSON.stringify({ tree }, null, 2));
const processor = unified()
.use(hast ? rehypeRemark : undefined)
.use(remarkMdx)
Expand Down
2 changes: 2 additions & 0 deletions processor/transform/rehype-toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const rehypeToc = (): Transformer<Root, Root> => {
) as Heading[];
if (!headings.length) return;

console.log(JSON.stringify({ tree }, null, 2));

const min = Math.min(...headings.map(getDepth));
const root = h();
root.children.push(h('ul'));
Expand Down