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

build: Generate headings with anchors #270

Closed
wants to merge 2 commits into from
Closed

build: Generate headings with anchors #270

wants to merge 2 commits into from

Conversation

juliaogris
Copy link
Member

@juliaogris juliaogris commented Feb 10, 2024

Generate headings with anchors with md tool, in the same way GitHub creates
anchors on .md pages. Use the same style of IDs: heading text with all
non-letter/numbers replaced by single dash.

In preparatory step rework walk function in the Markdown generation. We now
allow for nodes not only to be modified but also to be replaced or deleted.

For what we are trying to achieve here this might be over-kill, but it is
preparatory work for building a multiple-choice test generator.

It seems more correct to me to add a new type of node called anchoredHeading,
as it seems to be a different thing to an ordinary heading. in the markdown
page, Tasks are also explicitly modeled when used instead of unordered
lists.

I'll put up an alternative PR that is just straight-forward overriding the
markdown.Heading.PrintHTML function for comparison.

Link: https://stackoverflow.com/questions/43273842/what-are-the-rules-of-converting-one-markdown-title-into-an-html-anchor/44443100#44443100
Issue: evylang/todo#61


Fixes evylang/todo#61

build-tools/md/main.go Outdated Show resolved Hide resolved
build-tools/md/anchor.go Outdated Show resolved Hide resolved
build-tools/md/main.go Outdated Show resolved Hide resolved
frontend/preview/development/releasing.html Outdated Show resolved Hide resolved
Rework `walk` function in the Markdown generation. We now allow for nodes not
only to be modified but also to be replaced or deleted.
Generate headings with anchors with md tool, in the same way GitHub creates
anchors on .md pages. Use the same style of IDs: heading text with all
non-letter/numbers replaced by single dash.

Link: https://stackoverflow.com/questions/43273842/what-are-the-rules-of-converting-one-markdown-title-into-an-html-anchor/44443100#44443100
@juliaogris
Copy link
Member Author

Closing this as it seems too complicated for what we are trying to achieve here in favor of #272 .

@juliaogris juliaogris closed this Feb 12, 2024
@juliaogris juliaogris deleted the anchors branch February 17, 2024 02:23
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.

Add copy-able anchors to rendered docs headings
2 participants