bazelbuild / stardoc

Stardoc: Starlark Documentation Generator
Apache License 2.0
108 stars 45 forks source link

Stardoc outputs <code> blocks around attribute default values which aren't recognised by GitHub #142

Closed illicitonion closed 1 year ago

illicitonion commented 2 years ago

rules_rust hosts its skydoc-generated documentation using GitHub Pages, e.g. at this URL: http://bazelbuild.github.io/rules_rust/crate_universe.html#repinning--updating-dependencies

We just had a bug report (https://github.com/bazelbuild/rules_rust/issues/1679) saying that quotes around the default values of attributes are fancy smart-quotes () rather than straight quotes ("), which means they can't be directly copied into starlark source.

It appears that this is because of the <code> block rendered by stardoc here: https://github.com/bazelbuild/stardoc/blob/6f274e903009158504a9d9130d7f7d5f3e9421ed/stardoc/templates/markdown_tables/func.vm#L18

As far as I can tell, GitHub doesn't recognise a <code> block at all. I can't find any details about it on any markdown references.

If instead we render the value in back-ticks, rather than a <code> block, GitHub will render these quotes verbatim.

While in general I'd view "your markdown renderer is incorrectly changing your content" as a user error, it feels like hosting docs on GitHub pages is probably the most likely form of hosting stardoc, GitHub-flavoured markdown should probably be a well-supported target of stardoc...