-
Notifications
You must be signed in to change notification settings - Fork 156
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
Various improvements in the rendering of math and references. rST ZIPs now support $...$ for inline math. #953
base: main
Are you sure you want to change the base?
Conversation
This should be merged after #951 [edit: which is now merged]. |
76e676a
to
7d04605
Compare
7d04605
to
4e905e4
Compare
When reviewing this, please also check how reference links and the References section look after the CSS changes. That might vary between browsers; I only tested desktop Firefox (115.1.0esr) and Chromium (124.0.6367.118) on Debian. It's difficult to test mobile without having GitHub Pages rendering of PRs. |
4e905e4
to
cb9a900
Compare
cb9a900
to
976d268
Compare
f472b90
to
a9fc3ae
Compare
7e35f12
to
7c2bd6c
Compare
7c2bd6c
to
00e90e7
Compare
else | ||
if [ "x$1" = "x--pandoc" ]; then | ||
# Not actually MathJax. KaTeX is compatible if we use the right headers. | ||
pandoc --mathjax --from=markdown --to=html "${inputfile}" --output="${outputfile}.temp" |
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.
Yes I had to add --mathjax
(relative to the pandoc
command that was previously in the Makefile
) as part of switching from MathJax to KaTeX. That's because KaTeX is compatible with MathJax's representation of math spans as:
<span class="math">\(latex code\)</span>
(class="math inline"
also works.) Previously the \(
\)
delimiters were not being added by pandoc
; that's what the --mathjax
option does. multimarkdown
adds them without an explicit option.
The reason why I didn't just immediately switch to MultiMarkdown in this PR, is that it is not packaged for Linux distributions. It has to be built from source (requiring CMake, for the current version). The build is pretty straightforward though, so I'll switch the default once I've added it to the docker image and added some documentation. |
…tent between Markdown and reStructuredText. (This also anticipates a possible switch from Pandoc to Multimarkdown; the changes are designed to work with both.) Signed-off-by: Daira-Emma Hopwood <[email protected]>
Signed-off-by: Daira-Emma Hopwood <[email protected]>
Signed-off-by: Daira-Emma Hopwood <[email protected]>
Signed-off-by: Daira-Emma Hopwood <[email protected]>
Signed-off-by: Daira-Emma Hopwood <[email protected]>
(zip-guide *incorrectly* said that we were already using KaTeX. This has been wrong since zcash#645.) Signed-off-by: Daira-Emma Hopwood <[email protected]>
Signed-off-by: Daira-Emma Hopwood <[email protected]>
This supports MultiMarkdown as well as Pandoc, using `make MARKDOWN_OPTION=--mmd` Signed-off-by: Daira-Emma Hopwood <[email protected]>
Signed-off-by: Daira-Emma Hopwood <[email protected]>
00e90e7
to
96dafb2
Compare
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.
utACK with minor questions
preprocessrst.sh
Outdated
# which is much easier than trying to handle escapes within a capture; | ||
# I don't even know if the latter is possible. | ||
|
||
sed 's|[\][$]|💲|g' "$1" | sed 's|[$]\([^$]\+\)[$]|:math:`\1`|g' | sed 's|💲|$|g' |
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.
Clever approach!
zips/zip-0203.rst
Outdated
If the expiry is at block height $N\!$, then the transaction must be included in block | ||
$N$ or earlier. Block $N+1$ will be too late, and the transaction will be | ||
removed from the mempool. | ||
|
||
The new consensus rule will enforce that the transaction will not be considered valid if | ||
included in block of height greater than $N$, and blocks that include expired | ||
included in block of height greater than $N\!$, and blocks that include expired |
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.
Why the additions of \!
here? Elsewhere in this commit I've seen a bunch of removals, and I'm not sure what the change means.
@@ -145,15 +145,15 @@ Transaction Format | |||
|``1`` |``flagsOrchard`` |``byte`` |An 8-bit value representing a set of flags. Ordered from LSB to MSB: | | |||
| | | | * ``enableSpendsOrchard`` | | |||
| | | | * ``enableOutputsOrchard`` | | |||
| | | | * The remaining bits are set to ``0``. | | |||
| | | | * The remaining bits are set to :math:`0\!`. | |
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.
Why are these still using :math:
instead of $...$
?
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+ | ||
|``8`` |``valueBalanceOrchard`` |``int64`` |The net value of Orchard spends minus outputs. | | ||
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+ | ||
|``32`` |``anchorOrchard`` |``byte[32]`` |A root of the Orchard note commitment tree at some block | | ||
| | | |height in the past. | | ||
+-----------------------------+--------------------------+----------------------------------------+---------------------------------------------------------------------+ | ||
|``varies`` |``sizeProofsOrchard`` |``compactSize`` |Length in bytes of ``proofsOrchard``. Value is | | ||
| | | |:math:`2720 + 2272 \cdot \mathtt{nActionsOrchard}`. | | ||
| | | |:math:`2720 + 2272 \cdot \mathtt{nActionsOrchard}\!`. | |
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.
Same question.
From the Asset Digest, we derive a specific Asset Base within each shielded protocol using the applicable hash-to-curve algorithm. This Asset Base is included in shielded notes. | ||
|
||
Let | ||
|
||
- $\mathsf{asset\_desc}$ be the asset description, which includes any information pertaining to the issuance, and is a byte sequence of up to 512 bytes which SHOULD be a well-formed UTF-8 code unit sequence according to Unicode 15.0.0 or later. | ||
- $\mathsf{ik}$ be the issuance validating key of the issuer, a public key used to verify the signature on the issuance transaction's SIGHASH. | ||
|
||
Define $\mathsf{AssetDigest_{AssetId}} := \textsf{BLAKE2b-512}(\texttt{"ZSA-Asset-Digest"},\; \mathsf{EncodeAssetId}(\mathsf{AssetId}))\!$, | ||
Define $\mathsf{AssetDigest_{AssetId}} := \textsf{BLAKE2b-512}(\texttt{“ZSA-Asset-Digest”},\; \mathsf{EncodeAssetId}(\mathsf{AssetId}))$, |
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.
Unicode quotes like this are a little annoying; unless you have the correct editor they're a challenge to work with.
Make the style of reference links and references (almost) consistent between Markdown and reStructuredText.
The
$...$
syntax can now be —and is— used in rST, except in tables and headings. fixes Make$...$
work in reStructuredText ZIPs #952The reason why
$...$
doesn't work in general for tables and headings is that replacing it with:math:`...`
throws off the column-sensitive markup. Things like that are why column-sensitive markup is a bad idea.In most cases when using
$...$
followed by a punctuation mark, there is no need to manually correct spacing (in either rST or Markdown). Therender.sh
script does it automatically if required. This does not apply to:math:`...`
.Math is rendered using KaTeX instead of MathJax. fixes Switch from MathJax to KaTeX for ZIP rendering #432, fixes The size of rendered math in ZIPs is inconsistent between reloads #375
The rendering of math from Markdown is greatly improved. Previously it could only handle simple expressions that could be rendered at low quality as text; now it supports everything that KaTeX supports, and the quality of rendering is consistent (if not quite up to
pdflatex
standards).This PR is also preparation for switching to MultiMarkdown. MultiMarkdown fixes the duplicate reference bug (References are duplicated in the rendering of Markdown ZIPs #893) and also has some nice features like colspan in tables (use$n$ $n$ columns).
|
characters on the right-hand-side of a table entry to make it span