-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Markdown is retained in page descriptions #1739
Comments
Its intended since 1.x. We dont render the html part because #1066 If we strip it out, its hard to tell which to remove
or
or
There are many edge cases that can even cause more headache |
My proposal is basically to render the description separately from the rest of the page and in that process remove any markdown that isn't actually text displayed to the end user such as the brackets and URL for the link markdown. Basically like how it would ultimately be displayed on the page minus any hyperlinks or formatting. Edit: While there probably is some edge cases with this, I think if possible it would probably be a better way to handle it in most situations. Though the proposal that other fella made on having a description field next to the pages URL and title would also probably be a sufficent and arguably better solution (since you could customise it to not be exactly the same as the first sentence). |
My last response was written on a phone so I wasn't able to be as detailed but to be clear I mean like the first example you gave, so this: **This hack is [always enabled](all-hacks.md#always-enabled-hacks) when using the Mod Launcher.** Would resolve as this:
|
A better solution is to allow description frontmatter like in v2. If not defined, we still go with current behavior To be honest as a user i’d prefer rendering the markdown as the meta description. I might be wrong but this meta description has been like this since a year ago. I will close this issue as wontfix. We will accept PR on the description as frontmatter though |
🐛 Bug Report
The
og:description
meta tag will contain raw markdown if the sentence it's derived from contains any.Have you read the Contributing Guidelines on issues?
Yes.
To Reproduce
Create a page wherein the first sentence contains markdown. Here's an example from my site:
Expected behavior
I believe that Docusaurus should strip markdown out of page descriptions when generating them.
Actual Behavior
When this page is generated (via
yarn start
oryarn build
), theog:description
field will contain similar markdown to the original file (with links resolved) as showcased below:I initially noticed this when I shared one of the pages with this issue via Discord and the embed contained markdown:
Reproducible Demo
I initialised a brand new site with
npx docusaurus-init
and uploaded it here to demonstrate this issue.I decided to use a new site for this as the example documents
doc1.md
anddoc2.md
both contain markdown within their first sentence which is sufficent for demonstrating it.To replicate it yourself, simply run
yarn start
to start the site oryarn build
to build the site and inspect the page's HTML (example fromdoc1
):The text was updated successfully, but these errors were encountered: