It was a change I did not notice when upgrading Docsy from 0.8.0 to 0.11.0. Docsy changed the way heading self links are generated: they used to be rendered with JS and now they use a Hugo render hook.
This means two things:
- We need to enable them explicitly by overriding the `_default/_markup/render-heading.html` template.
- We need to add the self heading ourselves to headings that are not rendered by Hugo, i.e. HTML headings that we create ourselves.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
* Use json instead of json5 for syntax highlighting
Chroma, the library used for syntax highlighting in Hugo, does not support JSON5 so those code blocks were not highlighted.
However it supports comments in JSON so they are highlighted correctly in the rendered spec.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
* Add changelog
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
---------
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
When used with a text that includes multiple paragraphs, the partial created invalid HTML by nesting `<p>` elements.
It also changed the rendering by making "Changed in vX.XX:" a separate paragraph, when it is inline with a single paragraph.
To change that we do as with "Required" and add "Changed in vX.XX:" to the text before it is rendered, making it inline with the first paragraph.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
If the description is not set in the object definition, Hugo generates a weird string after "Required": `%!s(<nil>)`.
To avoid that, we default the description to an empty string when it is not set.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
According to the W3C's HTML validator, trailing slashes in void-element have no effect,
and might interact badly in some cases.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
The version of Inter is updated to use a variable font, which is supported widely among modern browsers.
Using `display: swap` means that the browser will render the text of the spec even before Inter is loaded, making the website appear to load faster on mobile.
Allow the browser to use the local Inter font if it exists.
The first commit allows to lazy-load the diagrams, which should improve the loading time of the CS API on mobile. In the process it also improves the alt text of the images.
The second commit serves the diagrams as high-resolution WebPs. Encoding a high resolution diagram as WebP gives a file of approximately the same size as the lower resolution PNG. For maximum compatibility we also serve them as a lower resolution WebP and a fallback PNG. WebP was chosen because it is one of the export formats of draw.io/diagrams.net, and it is widely available in modern browsers.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
The code relied on an IntersectionOberver, so the ToC was only updated when a heading was in the viewport.
It meant that if we jumped to a part of the text that has no heading, the ToC would still point to the old entry.
The new code looks for the correct heading when the view is scrolled so the correct entry is always selected.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
While 1405184765 redefined most fields to
be the appropriate object type, it missed one of them.
Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
The `<>` delimiters are not necessary for the shortcode to be rendered inline, and in some cases they break some expectations: a shortcode that is separated from other text to be in its own paragraph is not actually wrapped by a `p` element, breaking the spacing between paragraphs.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Docsy does not set the `height` anymore, but the `min-height`, which doesn't seem to affect scroll-anchoring.
See f22a70ec56
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Use `p` elements to separate paragraphs instead of `br` and enforce single paragraphs to be wrapped in `p` for consistency.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
* Rename .htmltest.yaml to .htmltest.yml
This is almost nothing but htmltest expects this exact name by default, so when running the
binary locally, it avoids to have to bother with providing the name of the config file.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
* Add changelog
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
---------
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
I did a quick search of the "deprecated" word in the data folder and set the
field where the description says that a property is deprecated.
This does not change the rendering of the spec because the
descriptions already talk about the deprecation,
but it can be used by tools that rely on the OpenAPI definitions and JSON Schemas.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>