add permalinks to article headings #84

Closed
opened 2025-11-18 14:43:46 +01:00 by Moiety · 6 comments
Moiety commented 2025-11-18 14:43:46 +01:00 (Migrated from codeberg.org)
No description provided.
Moiety commented 2025-11-19 09:08:14 +01:00 (Migrated from codeberg.org)

are there any good alternatives to markdown-it-anchor? because that doesn’t seem to work how I’d like it to.

are there any good alternatives to markdown-it-anchor? because that doesn’t seem to work how I’d like it to.
Moiety commented 2025-11-20 08:56:25 +01:00 (Migrated from codeberg.org)

there’s Id Attribute which you can pair with heading-anchors. that uses Web Components which i don’t want to do just yet; especially not for something that should be easy to do on compile.

there’s [Id Attribute](https://www.11ty.dev/docs/plugins/id-attribute/) which you can pair with [heading-anchors](https://github.com/daviddarnes/heading-anchors). that uses Web Components which i don’t want to do just yet; especially not for something that _should_ be easy to do on compile.
Moiety commented 2025-11-20 10:47:21 +01:00 (Migrated from codeberg.org)

i think this’ll require a custom renderer.

i think this’ll require a custom renderer. - [markdown-it-anchor: custom permalink](https://github.com/valeriangalliat/markdown-it-anchor?tab=readme-ov-file#custom-permalink) - [markdown-it design principles](https://github.com/markdown-it/markdown-it/blob/master/docs/architecture.md)
Moiety commented 2025-11-20 11:49:14 +01:00 (Migrated from codeberg.org)

did some more reading, decided to stick wtih markdown-it-anchor for now. i would like to dive into this further at some point.

important note: most solutions seem to ignore § 2.5.8 Target Size. technically inline links are exempt (mine are inline). but it was easy enough to set the minimum size to 24px and position them correctly.

did some more reading, decided to stick wtih markdown-it-anchor for now. i would like to dive into this further at some point. important note: most solutions seem to ignore [§ 2.5.8 Target Size](https://www.w3.org/TR/WCAG22/#target-size-minimum). technically inline links are exempt (mine are inline). but it was easy enough to set the minimum size to 24px and position them correctly.
Moiety commented 2025-11-20 12:00:39 +01:00 (Migrated from codeberg.org)
further resources: - [Are your Anchor Links Accessible?](https://amberwilson.co.uk/blog/are-your-anchor-links-accessible/) - [Accessible anchor links with Markdown-it and Eleventy](https://nicolas-hoizey.com/articles/2021/02/25/accessible-anchor-links-with-markdown-it-and-eleventy/) - [You’re (probably) doing anchor links wrong](https://www.codejam.info/2021/06/you-re-probably-doing-anchor-links-wrong.html) (most annoying article title goes to…) - [11ty Slugs and Anchors](https://11ty.rocks/eleventyjs/slugs-anchors/)
Moiety commented 2025-11-20 14:46:47 +01:00 (Migrated from codeberg.org)

A few notes:

  • This replaces the permalink-heading component
  • This introduces the section shortcode
A few notes: - This replaces the `permalink-heading` component - This introduces the `section` shortcode
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
zoe/moiety.me#84
No description provided.