diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-15 09:52:08 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-15 09:52:08 +0100 |
| commit | 942fa6636d34a70dcd3d1dfe91a81ea6893f481e (patch) | |
| tree | 1b336e569e1548d740bf92bc07e8debba965ce3f | |
| parent | 618beb1ac1cd04b203654d5a019c0ed04e4c26cb (diff) | |
Fix raw block highlighting
| -rw-r--r-- | library/src/text/raw.rs | 2 | ||||
| -rw-r--r-- | tests/ref/text/raw-code.png | bin | 40759 -> 46140 bytes | |||
| -rw-r--r-- | tests/typ/text/raw-code.typ | 15 |
3 files changed, 16 insertions, 1 deletions
diff --git a/library/src/text/raw.rs b/library/src/text/raw.rs index aa3a10d7..225c257d 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<syntect::parsing::SyntaxSet> = - 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<synt::Theme> = Lazy::new(|| synt::Theme { diff --git a/tests/ref/text/raw-code.png b/tests/ref/text/raw-code.png Binary files differindex a326b41e..e7df5a34 100644 --- a/tests/ref/text/raw-code.png +++ b/tests/ref/text/raw-code.png diff --git a/tests/typ/text/raw-code.typ b/tests/typ/text/raw-code.typ index d89f1c05..41d20ead 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 <iostream> + +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 <!DOCTYPE html> |
