Closed gpleiss closed 9 years ago
This is pretty cool. Why did you choose [text][anchor]
vs something more inline with markdown's current syntax for links?
The [text][component_name]
syntax is the markdown syntax for reference links. We were toying around with other syntax such as [text](?name=component_name)
or something like that, but reference links seemed to be the cleanest.
I agree, I think reference one makes the most sense too, very good choice.
We moved the link_defs
logic into the MarkdownRenderer
- in the preprocess
method. We inject the LinkHelper
into the MarkdownRenderer
:smiley:
What is the status on this PR?
Oops, this dropped off my radar, merged it in, thanks for updating with the feedback :-)
Our docs have lots of links to other components, e.g.:
These links are a little brittle, because we could change the name or the categories of the linked components, and then these links would be broken.
This PR adds the ability to use reference-style links between components, that follow the form
[description of link][component_name]
. These links even work for components in different categories. So the able example would become:If a component belongs to multiple categories, the reference link will link to the first category. For example, if "list_inline" belongs to both the "Elements" and "CSS" categories, a reference link to "list_inline" would look like "/elements.html#list_inline".
If there is a reference link to a component that doesn't exist, hologram throws a warning.
cc/ @drpep @bebepeng @stubbornella