diff --git a/library/src/text/raw.rs b/library/src/text/raw.rs index aa3a10d73..225c257d9 100644 --- a/library/src/text/raw.rs +++ b/library/src/text/raw.rs @@ -281,7 +281,7 @@ fn to_syn(RgbaColor { r, g, b, a }: RgbaColor) -> synt::Color { /// The syntect syntax definitions. static SYNTAXES: Lazy = - Lazy::new(|| syntect::parsing::SyntaxSet::load_defaults_newlines()); + Lazy::new(|| syntect::parsing::SyntaxSet::load_defaults_nonewlines()); /// The default theme used for syntax highlighting. pub static THEME: Lazy = Lazy::new(|| synt::Theme { diff --git a/tests/ref/text/raw-code.png b/tests/ref/text/raw-code.png index a326b41ef..e7df5a345 100644 Binary files a/tests/ref/text/raw-code.png and b/tests/ref/text/raw-code.png differ diff --git a/tests/typ/text/raw-code.typ b/tests/typ/text/raw-code.typ index d89f1c055..41d20ead5 100644 --- a/tests/typ/text/raw-code.typ +++ b/tests/typ/text/raw-code.typ @@ -1,6 +1,7 @@ // Test code highlighting. --- +#set page(width: 180pt) #set text(6pt) ```typ = Chapter 1 @@ -25,7 +26,9 @@ fn advance(state: State<'_>) -> State<'_> { ``` --- +#set page(width: 180pt) #set text(6pt) + ```py import this @@ -37,6 +40,18 @@ def hi(): #set page(width: 180pt) #set text(6pt) +```cpp +#include + +int main() { + std::cout << "Hello, world!"; +} +``` + +--- +#set page(width: 180pt) +#set text(6pt) + #rect(inset: (x: 4pt, y: 5pt), radius: 4pt, fill: rgb(239, 241, 243))[ ```html