-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fallback to slugified title as id for non-exact, non-code refere…
…nces (`[Hello World][]` -> `[hello-world][]`) With a heading like `## Welcome`, we should be able to cross-reference it with `[Welcome][]`, without having to specify the actual, slugified identifier: `[Welcome][welcome]`. This is compliant with the original Markdown spec. How does it work? When the base Markdown converter doesn't convert a reference, autorefs kicks in. It converts the yet-unresolved reference to an `autoref` HTML element. If an identifier was explicitly given, it creates a regular `autoref` element like before. If only a title was provided, then there are two scenarios: - the title converts to a `code` HTML element, in which case we create a regular `autoref` again (important for API docs) - the title does not convert to a `code` HTML element, in which case we add a slug to the `autoref` element `autoref` elements without a slug are handled like before. `autoref` elements with a slug will first try to find an URL for the initial identifier (which is the title), and if that fails, will try again with the slugified title. Slugification is made with the `toc` extension's `slugify` function. Issue-58: #58
- Loading branch information
Showing
2 changed files
with
119 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters