-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix #17260 render \
properly in nim doc, rst2html
#17315
fix #17260 render \
properly in nim doc, rst2html
#17315
Conversation
a4e5e12
to
c6a4287
Compare
\a
properly in nim doc\a
properly in nim doc, rst2html
\a
properly in nim doc, rst2html\
properly in nim doc, rst2html
9c32c60
to
062a77c
Compare
I don't understand your vigor for exact replicating Markdown behavior. Using
The cases when we need a standalone
You are a little cunning here. This bug that you showed was actually introduced in double backtick elimination in d447c0f , previously it was rendered OK with double backticks. For the time being you can just use double backticks wherever a backslash is present. |
What? It's much worse after your PR. Why would there be double backslashes? o.O |
@Araq The essence of this PR is that after the recent double-backtick elimination any changed markup containing backslashes got broken because backslashes are interpreted differently in single backticks. So @timotheecour tries to hotfix that. Which is also dangerous because there can exist markup in single backticks that relies on old behavior. |
So undo the commits that use single backticks everywhere. |
Why not just undo the changes where it breaks something? That should only be a few changes (most of the time, backticks are used around variable names). IMO it's not worth it to sacrifice using single backticks. |
@Araq I don't understand this comment. The double backslashes in the rendered html are correct. There is a double backslash because
whether this should written in the doc comment as ## replaces `\n` by `\\n` (as enabled by this PR)
or
## replaces ``\n`` by ``\\n`` (as was needed in 1.4 to get the desired html, but still possible after this PR) is a different question, but your suggestion that there should be no double backslashes here is incorrect.
I don't see how the original text (in the rendered html) from 8caf257 was confusing, it conveys exactly what the proc does. This is consistent with other uses in the manual and elsewhere in that |
Ok, ok, I take it back. That doesn't mean that I can review this, I cannot, I have no idea what changed and why. |
The example from the |
062a77c
to
fa3a8dc
Compare
PTAL, I'm now honoring these:
I've added tests to tests/stdlib/trstgen.nim; before this PR, there were no tests for interpreted text or inline literals |
@narimiran's turn. |
ping @narimiran |
/cc @a-mr
\v
,\\
, etc incorrectly #17260before PR:
https://nim-lang.github.io/Nim/system.html#addEscapedChar%2Cstring%2Cchar
![image](https://user-images.githubusercontent.com/2194784/110565573-8cad8880-8103-11eb-900b-05934920959f.png)
after PR:
note 1
the fix for this should not be controversial:
note 2
the fix for this is more controversial but IMO is the correct approach:
I'm treating this as legal:
because:
addEscapedChar
docs)\v
,\\
, etc incorrectly #17260 (comment):the rst behavior has design flaws / limitations, eg code directive with single backslash character not interpreted as expected sphinx-doc/sphinx#8396
this does behave differently from rst2html as noted there
backticks are rarely needed, eg we can use:
## see `system.[]=` # no need to render a backtick inside the backtick pair
for simpler doc links (nim-lang/RFCs#125) this also shouldn't be a problem:
## see `system.[]=`_
note 3
for the rare cases where we'll want to show a backtick character in docs (outside of code blocks/runnableExamples where this works fine), eg to distinguish
case
from`case`
, we should use markdown syntax:it's flexible and has saner escaping semantics (just increase the number of surrounding backticks)
future work
\|
inside a table cell should render as|
, not\|
(but outside a table cell, it should render as in this PR); I've edited the test to make it pass but in future work we should address this edge casethere are workarounds until this is addressed, eg:
split the rendered pipe in 2:
or using a different unicode char for the pipe https://stackoverflow.com/a/43070960/1426932