Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting headings from a markdoc file using the render() method returns an empty object. #6855

Closed
1 task
hammadmajid opened this issue Apr 15, 2023 · 2 comments · Fixed by #7095
Closed
1 task
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@hammadmajid
Copy link

What version of astro are you using?

2.3.0

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Windows

What browser are you using?

Edge

Describe the Bug

When I try to get the headings from a markdoc file using the render() method, it returns an empty object.

import { getEntryBySlug } from 'astro:content';

const entry = await getEntryBySlug('blog', 'post-1');
const { Content, headings } = await entry.render();

console.log(headings) // []
console.log(typeof headings) // object

post-1 at src/content/blog/post-1.mdoc contains a few different level of headings and they rendered as expected by Content.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-vwtxh9

Participation

  • I am willing to submit a pull request for this issue.
@matthewp matthewp added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Apr 28, 2023
@bholmesdev
Copy link
Contributor

This is expected at the moment! headings and ID calculation are being tackled in the next patch release 👍

@paulrudy
Copy link
Contributor

Thanks for adding markdoc heading render @bholmesdev! Now I don't have to roll my own :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants