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

Add Var component support #37

Merged
merged 2 commits into from
Dec 6, 2024
Merged

Add Var component support #37

merged 2 commits into from
Dec 6, 2024

Conversation

ptgott
Copy link
Contributor

@ptgott ptgott commented Dec 4, 2024

Closes #14
Closes #6

Copy the Var component VarsProvider context provider from gravitational/docs and adapt them to the Docusaurus site. Edit the remark-update-tags to not remove Var components before building the docs site.

Fix the visitor test function in rehype-hljs. Check for Var placeholders as well as Var tags, since otherwise the test won't work in the second visit call.

@ptgott
Copy link
Contributor Author

ptgott commented Dec 4, 2024

Stacked on #36

Copy link

github-actions bot commented Dec 4, 2024

🤖 Amplify preview here: https://paul-gottschling-2024-12-3-var.d2mrezcly5gcqm.amplifyapp.com

Preview details
  • LAST_UPDATED_AT: 2024-12-04T21:55:03.700000+00:00
  • JOB_ID: 0000000009
  • JOB_STATUS: SUCCEED
  • COMMIT_ID: 4b7161b

@ptgott ptgott marked this pull request as ready for review December 4, 2024 17:22
@ptgott ptgott requested a review from taraspos December 4, 2024 17:26
@ptgott ptgott force-pushed the paul.gottschling/2024-11-26-code-snippet branch from 185dee2 to cbb5e66 Compare December 4, 2024 17:46
Base automatically changed from paul.gottschling/2024-11-26-code-snippet to main December 4, 2024 18:44
Closes #14

Copy the `Var` component `VarsProvider` context provider from
`gravitational/docs` and adapt them to the Docusaurus site. Edit the
`remark-update-tags` to not remove `Var` components before building the
docs site.

Fix the visitor test function in `rehype-hljs`. Check for `Var`
placeholders as well as `Var` tags, since otherwise the test won't work
in the second `visit` call.

Also improve `rehype-hljs` by highlighting any unlabeled code snippets
as `text` to avoid rendering issues.
@ptgott ptgott force-pushed the paul.gottschling/2024-12-3-var branch from 759cee1 to aa245fe Compare December 4, 2024 19:10
@ptgott
Copy link
Contributor Author

ptgott commented Dec 4, 2024

@taraspos I fixed this issue in aa245fe

Don't check text values in the visitor test function. Since we execute
this function against every rehype AST node in the docs, don't create a
RegExp and match it to find `Var` tags or placeholders. We do this
inside the visitor functions anyway.
@ptgott ptgott merged commit 833b276 into main Dec 6, 2024
4 checks passed
@ptgott ptgott deleted the paul.gottschling/2024-12-3-var branch December 6, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants