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

docs: validate that the docs can be parsed by mdx #2711

Merged
merged 1 commit into from Feb 18, 2021

Conversation

ethomson
Copy link
Contributor

Although our documentation is rendered for the "in the box" docs by cmark-gfm, the upstream docs site (docs.npmjs.com) uses mdx, which is a much stricter parser. Update our docs generator site to ensure that mdx can parse our documentation as well, to ensure that we get fast feedback when it would fail.

@ethomson ethomson requested a review from a team as a code owner February 16, 2021 18:59

class MarkdownError extends Error {
constructor(file, inner) {
super(`failed to parse ${file}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care about the original error being eaten here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great use case for the error cause proposal, but lacking that, you could make MarkdownError extend AggregateError instead, and preserve the original error that way?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ljharb @wraithgar I don't think we care that much about this until we actually run into a problem making the docs pass/build. We can backlog some work to improve this & feel free to add changes.

@darcyclarke darcyclarke added Release 7.x work is associated with a specific npm 7 release release: next These items should be addressed in the next release semver:patch semver patch level for changes labels Feb 17, 2021
Copy link
Contributor

@darcyclarke darcyclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


class MarkdownError extends Error {
constructor(file, inner) {
super(`failed to parse ${file}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ljharb @wraithgar I don't think we care that much about this until we actually run into a problem making the docs pass/build. We can backlog some work to improve this & feel free to add changes.

Although our documentation is rendered for the "in the box" docs by
cmark-gfm, the upstream docs site (docs.npmjs.com) uses mdx, which is
a much stricter parser.  Update our docs generator site to ensure that
mdx can parse our documentation as well, to ensure that we get fast
feedback when it would fail.

PR-URL: npm#2711
Credit: @ethomson
Close: npm#2711
Reviewed-by: @darcyclarke
@nlf nlf changed the base branch from latest to release/v7.5.5 February 18, 2021 20:49
@nlf nlf force-pushed the ethomson/docs-mdx-validation branch from 2d3c4ff to af4422c Compare February 18, 2021 20:49
@nlf nlf merged commit af4422c into npm:release/v7.5.5 Feb 18, 2021
@nlf nlf mentioned this pull request Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: next These items should be addressed in the next release Release 7.x work is associated with a specific npm 7 release semver:patch semver patch level for changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants