Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more situations to the angle bracket test. #138

Closed

Conversation

adam-azarchs
Copy link
Contributor

Examples to demonstrate
#137.

Currently these tests will fail. I actually don't know where to find the code behind util.htmlEscape, which is what would need to be fixed.

@adam-azarchs adam-azarchs force-pushed the azarchs/angle-brackets branch from bd01780 to 3ff4783 Compare October 11, 2022 20:06
@adam-azarchs
Copy link
Contributor Author

The test failure is

FAIL: Actual did not match golden.
11c11
< in a `&lt;code block&gt;`.
---
> in a `<code block>`.
70c70
< foo = "&lt;thing&gt;"
---
> foo = "<thing>"
80c80
< | <a id="bracket_function-md_string"></a>md_string |  A markdown string.   |  <code>"`1&lt;&lt;10`"</code> |
---
> | <a id="bracket_function-md_string"></a>md_string |  A markdown string.   |  <code>"&#96;1&lt;&lt;10&#96;"</code> |
88c88
< deprecated for &lt;reasons&gt; as well as `&lt;reasons&gt;`.
---
> deprecated for &lt;reasons&gt; as well as `<reasons>`.
103c103
< foo = "&lt;brackets&gt;"
---
> foo = "<brackets>"

which are demonstrative of the problems described in #137.

In some of these, the problem could be resolved by replacing ` with <code>, though I'd consider that sub-optimal because it makes the markdown less idiomatic. It also doesn't really work for the code block (```) case - while that could be replaced by <pre> blocks, the result wouldn't get syntax highlighting, which would be unfortunate.

The md_string argument case is maybe enough of an edge case to not worry about it. I don't like that idea much on principle, though.

tetromino pushed a commit that referenced this pull request Jul 18, 2023
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

Co-authored-by: Adam Azarchs <[email protected]>
@adam-azarchs adam-azarchs deleted the azarchs/angle-brackets branch July 18, 2023 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant