Files
pandoc/test/typst-reader.typ
T
Samuel Huang 0bde362483 Typst reader: handle block content in inline element bodies (#11881)
Inline elements with a content body (emph, strong, underline, strike,
sub, super, smallcaps, highlight, link, lower, upper, ...) failed with
a parse error when the body contained a paragraph break or other block
content, since inline handlers parse their bodies with pInlines, which
cannot consume paragraph breaks. Example:
```
#emph[hi

there]
```
Generalize `fixNesting`, which already hoisted single block children out
of inline elements (#11017): the content of an inline element is now
split at paragraph breaks and at block children; inline runs are
wrapped back in the element, and block children are pulled out with
the styling applied to their own contents when they have a body. A
pandoc inline cannot span paragraphs, so this is the closest
structural rendering; the paragraph structure is preserved.

Remove the kludge we used for `#quote`, using `getInlineBody`; it
is no longer needed with this general fix.
2026-09-26 15:49:54 -07:00

101 lines
1.4 KiB
Typst

#set page(width: 10cm, height: auto)
#set heading(numbering: "1.")
= Fibonacci sequence
The Fibonacci sequence is defined through the
recurrence relation $F_n = F_(n-1) + F_(n-2)$.
It can also be expressed in _closed form:_
$ F_n = round(1 / sqrt(5) phi.alt^n), quad
phi.alt = (1 + sqrt(5)) / 2 $
#let count = 8
#let nums = range(1, count + 1)
#let fib(n) = (
if n <= 2 { 1 }
else { fib(n - 1) + fib(n - 2) }
)
The first #count numbers of the sequence are:
#align(center, table(
columns: count,
..nums.map(n => $F_#n$),
..nums.map(n => str(fib(n))),
))
#include "undergradmath.typ"
= Citations
Normal: #cite(<brown01>) or @brown01.
Prose: #cite(<brown01>, form: "prose")
Year: #cite(<brown01>, form: "year")
Author: #cite(<brown01>, form: "author")
= Inline elements across paragraphs
#emph[hi
there]
Hello #strong[again
and again] world.
#underline[Para one.
Para two.]
#smallcaps[#heading(level: 2)[smallcaps heading]]
= More inline elements across paragraphs
#link("https://example.com/typst")[link one
link two]
#emph[hi #block[struck middle] there]
#lower[Mixed Case
Also Here]
/ term: #emph[term one
term two]
Edge case #emph[
split here] continues.
= Splitting edge cases <edge-label>
Trailing edge #emph[splits
here] continues.
Consecutive breaks #emph[a
b] end.
Vanishing #emph[
] body.
#emph[#underline[nested one
nested two]]
#emph[a #grid(columns: 1)[cell] c]
Ref supplement: @edge-label[see this section].