Do not HTML-escape and use Markdown inline code for defaults#161
Do not HTML-escape and use Markdown inline code for defaults#161tetromino merged 6 commits intobazelbuild:masterfrom
Conversation
db8b8bb to
b79d934
Compare
|
@tetromino Could you review this PR? I created it when I noticed that updating Stardoc from |
|
I agree with the PR in principle, but before reviewing and merging this, I want to move the markdown renderer java code here from the bazel repo and finally delete renderer_binary.jar instead of needing to keep updating it. Work is in progress, give me (and my reviewers) a few days. |
|
Sounds good! I updated the PR to point to Bazel master and will happily make further changes post-move. Just mention me. |
This reverts commit 3feb2a9.
Co-authored-by: Adam Azarchs <adam.azarchs@10xgenomics.com>
|
@tetromino I rebased onto master including the move commit. |
|
@tetromino Thanks! It would be great if this could be included in a release soon to unblock rulesets that need to update for repo mapping support. |
This release will break all existing golden markdown tests for Stardoc users. In order to minimize the frequency of such breakage, I want to additionally land the following breaking changes before cutting a release:
|
… apply it properly Since bazelbuild#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 bazelbuild#161.
… apply it properly Since bazelbuild#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 bazelbuild#161.
… 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
Reverts #133 so that HTML escaping is not applied to Markdown. Instead, Markdown content such as docstrings can use HTML formatting and escape angle brackets with backslashes, HTML entities or inline code segments. Default values are embedded in inline code segments instead of
<code>tags, which does not require escaping.As a result, docstrings behave just like regular Markdown contexts while default values are rendered without smart quotes and can contain both
<and`without causing escaping issues.Also includes tests based on #138.
Fixes #137
Closes #138
Fixes #142
Closes #143
Requires bazelbuild/bazel#18867