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(v2): markdown title parser should ignore all forms of MDX import statements #4735

Merged
merged 1 commit into from
May 6, 2021

Conversation

nam-hle
Copy link
Contributor

@nam-hle nam-hle commented May 6, 2021

Motivation

Currently the markdown title can be parsed after some kind of import statements. For example:

import Component1 from '@site/src/components/Component1';

import './styles.css';

# Markdown Title

Lorem Ipsum

This PR allow the most of import syntaxes.

import DefaultComponent from '@site/src/components/Component1';
import DefaultComponent2 from '../relative/path/Component2';
import * as EntireComponent from './relative/path/Component3';

import { Component4 } from "double-quote-module-name";
import { Component6 as AliasComponent6 } from "module-name";
import DefaultComponent8, { DefaultComponent81 } from "module-name";
import DefaultComponent9, * as EntireComponent9 from "module-name";

import _ from 'underscore';
import "module-name";

# Markdown Title

Lorem Ipsum

Have you read the Contributing Guidelines on pull requests?

Yes.

Test Plan

Already added test for the change.

Related PRs

From @slorber's suggestion in #4729.

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 6, 2021
@netlify
Copy link

netlify bot commented May 6, 2021

@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label May 6, 2021
@slorber slorber changed the title feat(v2): support various import statements for markdown file fix(v2): markdown title parser should ignore all forms of MDX import statements May 6, 2021
@slorber
Copy link
Collaborator

slorber commented May 6, 2021

thanks for this :) looks great

@slorber slorber merged commit 404b4db into facebook:master May 6, 2021
@nam-hle nam-hle deleted the various-import branch May 6, 2021 10:45
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.

4 participants