summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGabriel Wu <qqbbnease1004@126.com>2023-05-30 16:46:56 +0800
committerGitHub <noreply@github.com>2023-05-30 10:46:56 +0200
commit87ee97ae5e4f557034bad98e5aec770f5c5a0f35 (patch)
tree777402dbc3cffbf947b06dbe3949d179f782ef65 /tests
parent47f81f0da57fb36214d2db19e425f9d73309e10a (diff)
Support syntax highlighting for more languages (#771)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/text/raw-code.pngbin38199 -> 43940 bytes
-rw-r--r--tests/typ/text/raw-code.typ66
2 files changed, 32 insertions, 34 deletions
diff --git a/tests/ref/text/raw-code.png b/tests/ref/text/raw-code.png
index 25735e9d..f772ba41 100644
--- a/tests/ref/text/raw-code.png
+++ b/tests/ref/text/raw-code.png
Binary files differ
diff --git a/tests/typ/text/raw-code.typ b/tests/typ/text/raw-code.typ
index 41d20ead..ca7b247d 100644
--- a/tests/typ/text/raw-code.typ
+++ b/tests/typ/text/raw-code.typ
@@ -3,6 +3,14 @@
---
#set page(width: 180pt)
#set text(6pt)
+#show raw: it => rect(
+ width: 100%,
+ inset: (x: 4pt, y: 5pt),
+ radius: 4pt,
+ fill: rgb(239, 241, 243),
+ place(right, text(luma(110), it.lang)) + it,
+)
+
```typ
= Chapter 1
#lorem(100)
@@ -11,10 +19,6 @@
#show heading: emph
```
----
-#set page(width: 180pt)
-#set text(6pt)
-
```rust
/// A carefully designed state machine.
#[derive(Debug)]
@@ -25,10 +29,6 @@ fn advance(state: State<'_>) -> State<'_> {
}
```
----
-#set page(width: 180pt)
-#set text(6pt)
-
```py
import this
@@ -36,10 +36,6 @@ def hi():
print("Hi!")
```
----
-#set page(width: 180pt)
-#set text(6pt)
-
```cpp
#include <iostream>
@@ -48,26 +44,28 @@ int main() {
}
```
----
-#set page(width: 180pt)
-#set text(6pt)
+```julia
+# Add two numbers
+function add(x, y)
+ return x * y
+end
+```
-#rect(inset: (x: 4pt, y: 5pt), radius: 4pt, fill: rgb(239, 241, 243))[
- ```html
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- </head>
- <body>
- <h1>Topic</h1>
- <p>The Hypertext Markup Language.</p>
- <script>
- function foo(a, b) {
- return a + b + "string";
- }
- </script>
- </body>
- </html>
- ```
-]
+ // Try with some indent.
+ ```html
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8">
+ </head>
+ <body>
+ <h1>Topic</h1>
+ <p>The Hypertext Markup Language.</p>
+ <script>
+ function foo(a, b) {
+ return a + b + "string";
+ }
+ </script>
+ </body>
+ </html>
+ ```