In Markdown table cells, apply HTML escaping only to code blocks, and apply it properly (#167)

In Markdown table cells, apply HTML escaping only to code blocks, and apply it properly

Since #161 removed HTML escaping for defaults and function docstrings, we should do the same for attribute and param docs in table cells.

The only limitations Markdown places on table cells are:
* no pipe characters (they must be escaped with a backslash)
* no newlines (they must be transformed into `<br>` or an HTML entity)

The latter restriction makes it impossible to have a fenced code block inside a table cell.

Therefore:
* we do not escape HTML or Markdown markup outside a fenced code block
* we keep existing logic for escaping newlines outside a fenced code block
* we fix fence detection (e.g. allowing more than 3 fence characters to support embedded code blocks in code blocks, allowing tildes as fence characters, properly handling language names, etc.);
* in code block content, we escape HTML, and we escape newlines as HTML entities (since `<br>` does not work in a `<pre><code>` block) - finally fixing code block newlines in table cells.
    
This is a followup to #161.

Partially addresses #118
12 files changed
tree: b057633129da514937bcb4e44963f9e370c6a864
  1. .bazelci/
  2. distro/
  3. docs/
  4. src/
  5. stardoc/
  6. test/
  7. .bazelignore
  8. .bazelrc
  9. .gitignore
  10. AUTHORS
  11. BUILD
  12. CHANGELOG.md
  13. CODEOWNERS
  14. CONTRIBUTING.md
  15. CONTRIBUTORS
  16. LICENSE
  17. maven_install.json
  18. MODULE.bazel
  19. README.md
  20. rules_jvm_external.patch
  21. setup.bzl
  22. update-release-binary.sh
  23. update-stardoc-docs.sh
  24. update-stardoc-tests.sh
  25. version.bzl
  26. WORKSPACE
README.md

Stardoc - Starlark Documentation Generator

Build status

Stardoc is a documentation generator for Bazel build rules written in Starlark.

Stardoc provides a Starlark rule (stardoc, see documentation) that can be used to build documentation for Starlark rules in Markdown. Stardoc generates one documentation page per .bzlfile.

Get Started

About Stardoc

Project Status

Skydoc deprecation

Stardoc is a replacement for the deprecated “Skydoc” documentation generator.

See Skydoc Deprecation for details on the deprecation and migration details.

Future plans

See our future plans for refactoring Stardoc to be more consistent with how Bazel evaluates .bzl files, and what it means for maintenance of this project.

Maintainer's guide

See the maintaner's guide for instructions for cutting a new release.