Skip to content

fix(v2): fix title logic (meta vs heading) + ignore fixed anchor id syntax - #4688

Merged
slorber merged 8 commits into
masterfrom
slorber/markdown-title-parsing-fixes
Apr 27, 2021
Merged

slorber merged 8 commits into
masterfrom
slorber/markdown-title-parsing-fixes

Conversation

@slorber

@slorber slorber commented Apr 27, 2021

Copy link
Copy Markdown
Collaborator

Motivation

Fixes #4665 (comment) + handle fixed anchor syntax

Keep behavior we had before:

  • frontmatter.title controls page meta in priority
  • markdown # title controls page h1 heading in priority

We should rather not use fixed anchor ids syntax on top level h1 headings, as user should not use h1 headings in his doc normally anyway:

  • writeHeadingIds cli will not write custom anchor ids for h1 md titles, and # myTitle remains untouched
  • a markdown title as # myTitle {#my-anchor} will now parse correctly title = myTitle

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

test

@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Apr 27, 2021
@slorber
slorber requested a review from lex111 as a code owner April 27, 2021 13:03
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 27, 2021
@netlify

netlify Bot commented Apr 27, 2021 •

Copy link
Copy Markdown

@netlify

netlify Bot commented Apr 27, 2021 •

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Apr 27, 2021 •

Copy link
Copy Markdown

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 87
🟢 Accessibility 96
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-4688--docusaurus-2.netlify.app/

@github-actions

github-actions Bot commented Apr 27, 2021 •

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 631 kB

ℹ️ View Unchanged
Filename Size Change
website/build/assets/css/styles.********.css 88 kB 0 B
website/build/assets/js/main.********.js 453 kB 0 B
website/build/blog/2017/12/14/introducing-docusaurus/index.html 62.3 kB 0 B
website/build/docs/introduction/index.html 235 B 0 B
website/build/index.html 27.1 kB 0 B

compressed-size-action

@slorber
slorber merged commit 8ebbc17 into master Apr 27, 2021
@slorber
slorber deleted the slorber/markdown-title-parsing-fixes branch August 17, 2021 18:00
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
…yntax (meta#4688)

* parseMarkdownContentTitle should ignore {#my-anchor-id} syntax

* use frontMatter.title in priority for page meta title

* parseMarkdownString should ignore fixed anchor ids syntax

* docs: make the distinction between headingTitle + metaTitle more clear + add useful todo

* docs: make the distinction between headingTitle + metaTitle more clear + add useful todo

* writeHeadingIds should ignore top-level md title like "# Title"
=> we are not supposed to create anchor links for h1 headers

* update tests

* fix doc tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Titles are not handled properly anymore

2 participants