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 a remark plugin for generating a TOC menu #483

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

ptgott
Copy link
Contributor

@ptgott ptgott commented Jul 9, 2024

As we reorganize the documentation, it becomes cumbersome to manually change lists of links to pages within the documentation, e.g., in table of contents pages for subsections of the docs. This change adds a remark plugin for generating a list of links to pages in the current directory.

The plugin works similarly to remark-includes, and accesses the local filesystem during the docs build. It replaces any lines consisting of (!toc!) with a list of links to pages in the current directory. The assumption is that a category page within a directory can use this to list contents.

@ptgott ptgott requested a review from avatus as a code owner July 9, 2024 14:29
Copy link

vercel bot commented Jul 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 9, 2024 4:18pm

avatus
avatus previously approved these changes Jul 9, 2024
}, new Set());

// Add rows to the menu page for non-menu pages.
let entries = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: i don't see this reference updated anywhere so we can change to const

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Fixed in 74911f2 (along with a .remarkrc update to stop this from breaking the remark linter).

As we reorganize the documentation, it becomes cumbersome to manually
change lists of links to pages within the documentation, e.g., in table
of contents pages for subsections of the docs. This change adds a remark
plugin for generating a list of links to pages in the current directory.

The plugin works similarly to `remark-includes`, and accesses the local
filesystem during the docs build. It replaces any lines consisting of
`(!toc!)` with a list of links to pages in the current directory. The
assumption is that a category page within a directory can use this to
list contents.
@ptgott ptgott force-pushed the paul.gottschling/2024-07-8-remark-toc branch from 32d7d3b to 74911f2 Compare July 9, 2024 16:10
@ptgott ptgott requested a review from avatus July 9, 2024 16:11
@ptgott ptgott merged commit 2f8b35c into main Jul 9, 2024
8 of 9 checks passed
travelton pushed a commit that referenced this pull request Aug 26, 2024
As we reorganize the documentation, it becomes cumbersome to manually
change lists of links to pages within the documentation, e.g., in table
of contents pages for subsections of the docs. This change adds a remark
plugin for generating a list of links to pages in the current directory.

The plugin works similarly to `remark-includes`, and accesses the local
filesystem during the docs build. It replaces any lines consisting of
`(!toc!)` with a list of links to pages in the current directory. The
assumption is that a category page within a directory can use this to
list contents.
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