Skip to content

feat(v2): various markdown string parsing improvements/fixes - #4590

Merged
slorber merged 6 commits into
masterfrom
slorber/extract-fix-excerpt
Apr 9, 2021
Merged

slorber merged 6 commits into
masterfrom
slorber/extract-fix-excerpt

Conversation

@slorber

@slorber slorber commented Apr 9, 2021

Copy link
Copy Markdown
Collaborator

Motivation

Refactors and improvements of the markdown parsing system:

  • Extract markdown-related code + tests in dedicated file
  • Clearer API surface
  • Title found in markdown content (not frontmatter) is returned as a separate attribute, not added to frontMatter.title => ability to handle those cases separately
  • Ability to extract title from markdown documents using the alternate markdown syntax (title\n===)
  • Fix empty excerpt when Markdown doc has a title: excerpt should simply skip/ignore the title
  • Duplicate title warning: better wording + ability to disable it (as it can be annoying for some sites after upgrading, cf RN website)
  • Initial code to have more strict frontmatter validation using Joi (to be completed)

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

tests

Related PRs

Follow-up of #4485 cc @armano2

Also related to #4582 (as we want to support better sites without any frontmatter at all)

@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Apr 9, 2021
@slorber
slorber requested a review from lex111 as a code owner April 9, 2021 14:03
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 9, 2021
@netlify

netlify Bot commented Apr 9, 2021 •

Copy link
Copy Markdown

@netlify

netlify Bot commented Apr 9, 2021

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Apr 9, 2021

Copy link
Copy Markdown

⚡️ Lighthouse report for the changes in this PR:

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

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

@github-actions

github-actions Bot commented Apr 9, 2021

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 576 kB

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

compressed-size-action

@slorber slorber changed the title feat(v2): improve markdown parsing feat(v2): various markdown string parsing improvements/fixes Apr 9, 2021
@slorber
slorber merged commit 4efe682 into master Apr 9, 2021
@slorber
slorber deleted the slorber/extract-fix-excerpt branch August 17, 2021 17:50
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
* extract createExcerpt code in separate file + add bad test

* almost working markdown parsing refactor

* complete parseMarkdownString refactor

* fix tests

* fix blog test issue

* fix docusaurus utils imports
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: new feature This PR adds a new API or behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants