-
Notifications
You must be signed in to change notification settings - Fork 25
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
Added escape for Sphinx characters to default value #49
Conversation
944d0b7
to
abe114c
Compare
(".//section/dl/dd/p", 'Default:'), | ||
(".//section/dl/dd/p/code/span", '420'), | ||
(".//section/dl/dd/p/code/span", "'*.rst"), | ||
(".//section/dl/dd/p/code/span", r"\['\*.rst',"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this look like in the rendered HTML (both HTML source, and in a browser) please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result from the test method:
In HTML (formatting mine):
<p>
Default:
<code class="docutils literal notranslate">
<span class="pre">'*.rst</span>
<span class="pre">_txt_</span>
<span class="pre">**strong**</span>
<span class="pre">*italic*</span>
<span class="pre">\`\`code\`\`'</span>
</code>
</p>
abe114c
to
2ca79b6
Compare
2ca79b6
to
9a02c55
Compare
else: | ||
arg.append(f"Default: {entry['default']}") | ||
# Put the default value in a literal block - but escape backticks already in the string | ||
default_str = str(entry['default']).replace('`', r'\`') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small problem: the
\`
is displayed in the webbrowser literally. I haven't been able to property escape it in Sphinx to display it properly in a literal block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Helps to fix #15