-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
The code for "LaTeX writer: fix spacing issue with list in definition list." (a26ec96) gets confused / does the wrong thing if the first item in the BulletList is a Div. There might be other cases where it has a similar issue.
Here's a test case (test.md
):
**Here is a dictionary item**
: <div>
Here is some text.
Here is a bullet list:
- Item 1.
- Item 2.
Here is another bullet list:
- Item 3.
- Item 4.
</div>
When rendering the bullet lists inside the Div inserts an extra \item[]
at the start of the bullet list, causing extra blank lines to be output.
Tested as:
pandoc -o test.tex test.md
Output (text.tex
):
\begin{description}
\item[\textbf{Here is a dictionary item}]
Here is some text.
Here is a bullet list:
\begin{itemize}
\tightlist
\item[]
\item
Item 1.
\item
Item 2.
\end{itemize}
Here is another bullet list:
\begin{itemize}
\tightlist
\item[]
\item
Item 3.
\item
Item 4.
\end{itemize}
\end{description}
I believe this is caused by the code treating the whole Div as isFirstInDefinition
meaning every bullet list inside the Div gets treated in that way. Possibly isFirstInDefinition
should be cleared as soon as anything is output inside the definition, although perhaps other nested items (particularly another definition inside the definition?) could cause that approach to fail?
Expected output (output if the Div is removed):
\begin{description}
\item[\textbf{Here is a dictionary item}]
Here is some text.
Here is a bullet list:
\begin{itemize}
\tightlist
\item
Item 1.
\item
Item 2.
\end{itemize}
Here is another bullet list:
\begin{itemize}
\tightlist
\item
Item 3.
\item
Item 4.
\end{itemize}
\end{description}
Wrapping the content in the Div is a peculiar behavior of our content generator. I can probably work around this by inserting some dummy item before the Div.