WebAssembly / WebAssembly/spec
Bikeshed is stripping backslashes from some latex newline commands
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 3.5k
- Forks
- 539
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 13
Description
Some latex tables in the core spec use the extra space argument to add extra vertical space between table rows, e.g. the \\[1ex] on line 660 of this example from
https://github.com/WebAssembly/spec/blob/main/document/core/exec/runtime.rst?plain=1#L655-L664
.. math::
\begin{array}{rcl}
S; F; E[\instr^\ast] &\stepto& S'; F'; E[{\instr'}^\ast] \\
&& (\iff S; F; \instr^\ast \stepto S'; F'; {\instr'}^\ast) \\
S; F; \FRAME_n\{F'\}~\instr^\ast~\END &\stepto& S'; F; \FRAME_n\{F''\}~\instr'^\ast~\END \\
&& (\iff S; F'; \instr^\ast \stepto S'; F''; {\instr'}^\ast) \\[1ex]
S; F; E[\TRAP] &\stepto& S; F; \TRAP
\qquad (\iff E \neq [\_]) \\
S; F; \FRAME_n\{F'\}~\TRAP~\END &\stepto& S; F; \TRAP \\
\end{array}
After sphinx, the content of bikeshed_singlehtml/index_fixed.html is
<div class="math notranslate nohighlight">
\[\begin{split}\begin{array}{rcl}
S; F; E[\href{#syntax-instr}{\mathit{instr}}^\ast] &\href{#exec-notation}{\hookrightarrow}& S'; F'; E[{\href{#syntax-instr}{\mathit{instr}}'}^\ast] \\
&& (\mathrel{\mbox{if}} S; F; \href{#syntax-instr}{\mathit{instr}}^\ast \href{#exec-notation}{\hookrightarrow} S'; F'; {\href{#syntax-instr}{\mathit{instr}}'}^\ast) \\
S; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F'\}~\href{#syntax-instr}{\mathit{instr}}^\ast~\href{#syntax-instr-control}{\mathsf{end}} &\href{#exec-notation}{\hookrightarrow}& S'; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F''\}~\href{#syntax-instr}{\mathit{instr}}'^\ast~\href{#syntax-instr-control}{\mathsf{end}} \\
&& (\mathrel{\mbox{if}} S; F'; \href{#syntax-instr}{\mathit{instr}}^\ast \href{#exec-notation}{\hookrightarrow} S'; F''; {\href{#syntax-instr}{\mathit{instr}}'}^\ast) \\[1ex]
S; F; E[\href{#syntax-trap}{\mathsf{trap}}] &\href{#exec-notation}{\hookrightarrow}& S; F; \href{#syntax-trap}{\mathsf{trap}}
\qquad (\mathrel{\mbox{if}} E \neq [\_]) \\
S; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F'\}~\href{#syntax-trap}{\mathsf{trap}}~\href{#syntax-instr-control}{\mathsf{end}} &\href{#exec-notation}{\hookrightarrow}& S; F; \href{#syntax-trap}{\mathsf{trap}} \\
\end{array}\end{split}\]</div>
When Bikeshed processes the file, it strips out one of the backslashes:
<div class="math notranslate nohighlight"> \[\begin{split}\begin{array}{rcl}
S; F; E[\href{#syntax-instr}{\mathit{instr}}^\ast] &\href{#exec-notation}{\hookrightarrow}& S'; F'; E[{\href{#syntax-instr}{\mathit{instr}}'}^\ast] \\
&& (\mathrel{\mbox{if}} S; F; \href{#syntax-instr}{\mathit{instr}}^\ast \href{#exec-notation}{\hookrightarrow} S'; F'; {\href{#syntax-instr}{\mathit{instr}}'}^\ast) \\
S; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F'\}~\href{#syntax-instr}{\mathit{instr}}^\ast~\href{#syntax-instr-control}{\mathsf{end}} &\href{#exec-notation}{\hookrightarrow}& S'; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F''\}~\href{#syntax-instr}{\mathit{instr}}'^\ast~\href{#syntax-instr-control}{\mathsf{end}} \\
&& (\mathrel{\mbox{if}} S; F'; \href{#syntax-instr}{\mathit{instr}}^\ast \href{#exec-notation}{\hookrightarrow} S'; F''; {\href{#syntax-instr}{\mathit{instr}}'}^\ast) \[1ex]
S; F; E[\href{#syntax-trap}{\mathsf{trap}}] &\href{#exec-notation}{\hookrightarrow}& S; F; \href{#syntax-trap}{\mathsf{trap}}
\qquad (\mathrel{\mbox{if}} E \neq [\_]) \\
S; F; \href{#syntax-frame}{\mathsf{frame}}_n\{F'\}~\href{#syntax-trap}{\mathsf{trap}}~\href{#syntax-instr-control}{\mathsf{end}} &\href{#exec-notation}{\hookrightarrow}& S; F; \href{#syntax-trap}{\mathsf{trap}} \\
\end{array}\end{split}\]</div>
Later this break's katex's rendering of the latex.
I'm not yet sure what's happening here, e.g. whether this is somehow an intended behavior of Bikeshed, or a bug, or what.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the LaTeX in core/exec/runtime.rst, especially the \[1ex] row separator, with the generated bikeshed_singlehtml/index_fixed.html. Trace the Sphinx-to-Bikeshed processing step that changes this sequence and verify the resulting KaTeX input. Done means the backslash is preserved and the affected table renders correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex
- Domain
- build-system, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100