Skip to content

Bug: Frontmatter not removed in Markdown Readme #2381

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

Closed
hrueger opened this issue Aug 30, 2023 · 3 comments · Fixed by #2387
Closed

Bug: Frontmatter not removed in Markdown Readme #2381

hrueger opened this issue Aug 30, 2023 · 3 comments · Fixed by #2387

Comments

@hrueger
Copy link
Contributor

hrueger commented Aug 30, 2023

Search terms

markdown, frontmatter, readme

Expected Behavior

The markdown parser in typedoc (for readmes) removes any yaml frontmatter as it is just metadata and should not be displayed to the end-user.

Actual Behavior

YAML frontmatter is converted to html and shown. Example:

---
title: Vision
---

# SHIFTY - Vision

becomes
grafik

However, we should just see the headline and not title: Vision.

Steps to reproduce the bug

  1. Create a readme with YAML frontmatter (like above)
  2. Build the docs
  3. See the frontmatter contents in the generated docs

Environment

  • Typedoc version: 0.24.8
  • TypeScript version: 5.0.0
  • Node.js version: 18.17.1
  • OS: Windows & macOS

Additional Info

Happy to fix that in a PR. Should be as simple as removing frontmatter via regex before passing it to marked. Maybe this should be a new config option?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Sep 3, 2023

frontmatter isn't standard markdown, it is rendered by both GitHub & npm, which TypeDoc generally tries to replicate.

I don't want to imply that TypeDoc supports frontmatter until (if ever) it does, which I think doing this by default would imply. A stripYamlFrontmatter option is probably fine...

@hrueger
Copy link
Contributor Author

hrueger commented Sep 3, 2023

Hi @Gerrit0, thanks for the reply! I agree with that, I'll make a pr adding the stripYamlFrontmatter option soon.

@hrueger
Copy link
Contributor Author

hrueger commented Sep 4, 2023

Thanks!

@Gerrit0 Gerrit0 removed the bug label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants