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

fix(mdx-loader): Ignore contentTitle coming after Markdown thematicBreak #9999

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Mar 29, 2024

Motivation

This fix shouldn't impact any user, apart some Meta OSS sites like React Native that decided to use h1 headings in the middle of a doc (which doesn't look good, but it is the current state):

---
title: Title that should be injected as h1
---

Some intro text

--- 

# Reference

## Methods

### `alert()`

Without this change, the frontMatter.title won't be injected as a h1 heading at the beginning of the doc (also called "synthetic heading" because it's not a Markdown # Title)

I don't really like to introduce such fancy edge case handling just for Meta sites, but the heuristic to ignore h1 after a thematic break still kind of makes sense for other sites, so if we can make it easier to upgrade to V3 Meta sites and it's not annoying for others, let's do it 🤷‍♂️

Test Plan

unit tests, React Native upgrade: facebook/react-native-website#4072

Test links

https://deploy-preview-9999--docusaurus-2.netlify.app/

@slorber slorber added pr: bug fix This PR fixes a bug in a past release. to backport This PR is planned to be backported to a stable version of Docusaurus labels Mar 29, 2024
@slorber slorber requested a review from Josh-Cena as a code owner March 29, 2024 14:00
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Mar 29, 2024
Copy link

netlify bot commented Mar 29, 2024

[V2]

Name Link
🔨 Latest commit 27d8362
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6606c99986c8c6000809bc86
😎 Deploy Preview https://deploy-preview-9999--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 69 🟢 98 🟢 96 🟢 100 🟠 88 Report
/docs/installation 🟠 68 🟢 96 🟢 100 🟢 100 🟠 88 Report
/docs/category/getting-started 🟠 75 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog 🟠 69 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 63 🟢 96 🟢 100 🟢 100 🟠 88 Report
/blog/tags/release 🟠 71 🟢 100 🟢 100 🟠 80 🟠 88 Report
/blog/tags 🟠 76 🟢 100 🟢 100 🟢 90 🟠 88 Report

@slorber slorber merged commit 1a5fe5c into main Mar 29, 2024
32 checks passed
@slorber slorber deleted the slorber/contentTitle-thematic-break branch March 29, 2024 14:07
Copy link

Size Change: 0 B

Total Size: 994 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 75.4 kB
website/build/assets/css/styles.********.css 114 kB
website/build/assets/js/main.********.js 767 kB
website/build/index.html 37.9 kB

compressed-size-action

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. to backport This PR is planned to be backported to a stable version of Docusaurus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants