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

Get yarn markdown-lint to work #21

Merged
merged 3 commits into from
Nov 5, 2024
Merged

Conversation

ptgott
Copy link
Contributor

@ptgott ptgott commented Nov 4, 2024

On gravitational/docs, the yarn markdown-lint script runs the docs site's remark-based linters on the Teleport documentation content. This change ensures that the script works as expected on Docusaurus content.

  • Add dependencies for yarn markdown-lint.
  • Add a build-remark script for building remark plugins in order to run the linter.
  • Copy .remarkrc.mjs from gravitational/docs, but add an updatePaths function to remark-includes to work with the plugin's new interface.
  • Edit getVersionFromFile to accommodate linting. Get a version if the file is currently in the content directory, which we need to do in order to get remarkIncludes to work when linting files in content. Also add branching in getCurrentDir to work with the structure of the content directory.
  • Update package.json to use the versions of remark packages found in gravitational/docs. This minimizes the content changes we'll need to make to accommodate the linting configuration.

On `gravitational/docs`, the `yarn markdown-lint` script runs the docs
site's `remark`-based linters on the Teleport documentation content.
This change ensures that the script works as expected on Docusaurus
content.

- Add dependencies for `yarn markdown-lint`.
- Add a `build-remark` script for building remark plugins in order to
  run the linter.
- Copy `.remarkrc.mjs` from `gravitational/docs`, but add an
  `updatePaths` function to remark-includes to work with the plugin's
  new interface.
- Edit `getVersionFromFile` to accommodate linting. Get a version if the
  file is currently in the `content` directory, which we need to do in
  order to get `remarkIncludes` to work when linting files in `content`.
  Also add branching in `getCurrentDir` to work with the structure of
  the `content` directory.
- Update package.json to use the versions of `remark` packages found in
  gravitational/docs. This minimizes the content changes we'll need to
  make to accommodate the linting configuration.
@ptgott ptgott requested a review from taraspos November 4, 2024 19:03
@taraspos
Copy link
Contributor

taraspos commented Nov 4, 2024

@ptgott seems like you need to review some dependencies

package.json Outdated
"unist-util-visit-parents": "^6.0.1",
"unist-util-find": "^1.0.2",
"unist-util-visit": "4.1.0",
"unist-util-visit-parents": "^5.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like some dependencies got downgraded

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to replicate our gravitational/docs configuration to minimize new linting errors. I had to fix new linting errors anyway, so I've reverted these downgrades

package.json Outdated
@@ -45,12 +46,12 @@
"@mdx-js/react": "^3.0.0",
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
"highlightjs-terraform": "https://github.com/highlightjs/highlightjs-terraform#eb1b9661e143a43dff6b58b391128ce5cdad31d4",
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why this is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We used this to enable HCL syntax highlighting in the previous docs site. We're using Docusaurus-native syntax highlighting now, so we shouldn't need this until (potentially) we address #6

- Revert some dependency downgrades
- Remove highlightjs-terraform
@ptgott ptgott force-pushed the paul.gottschling/2024-10-31-md-lint branch from f9f5dfe to cb937e5 Compare November 5, 2024 14:52
It is not enabled in CI, and has led to issues with rate limiting from
third-party sites in the past.
@ptgott ptgott merged commit 70ddb42 into main Nov 5, 2024
3 checks passed
@ptgott ptgott deleted the paul.gottschling/2024-10-31-md-lint branch November 5, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants