summaryrefslogtreecommitdiff
path: root/tests/typ/text/raw-code.typ
blob: 41d20ead5764b506bb894bd9e3a7403fae23983b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Test code highlighting.

---
#set page(width: 180pt)
#set text(6pt)
```typ
= Chapter 1
#lorem(100)

#let hi = "Hello World"
#show heading: emph
```

---
#set page(width: 180pt)
#set text(6pt)

```rust
/// A carefully designed state machine.
#[derive(Debug)]
enum State<'a> { A(u8), B(&'a str) }

fn advance(state: State<'_>) -> State<'_> {
    unimplemented!("state machine")
}
```

---
#set page(width: 180pt)
#set text(6pt)

```py
import this

def hi():
  print("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>
  <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>
  ```
]