-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// #import "@preview/tidy:0.3.0" | ||
#import "src/tidy.typ" | ||
|
||
#show raw.where(block: true): highlight | ||
|
||
#let module = ```` | ||
/// #example(``` | ||
/// [a #raw("foo") b] | ||
/// ```) | ||
let x = none | ||
|
||
/// #example(`[a #raw("foo") b]`) | ||
let y = none | ||
|
||
/// #example(raw(`[a #raw("foo") b]`.text), mode: "markup") | ||
let z = none | ||
|
||
/// #example(raw(lang: "typc", `[a #raw("foo") b]`.text)) | ||
let ß = none | ||
````.text | ||
#let module = tidy.parse-module( | ||
module, | ||
// preamble: "set raw(block: false);" | ||
) | ||
#tidy.show-module( | ||
module, | ||
sort-functions: none, | ||
style: tidy.styles.minimal, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# added by typst-test | ||
**/out/ | ||
**/diff/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#set page(width: 170pt, height: auto, margin: 0pt) | ||
#import "/src/tidy.typ": show-example as example, render-examples | ||
#let show-example = example.show-example.with( | ||
layout: (code, preview, ..sink) => { | ||
grid(columns: (1fr, 1fr), align: horizon, code, preview) | ||
} | ||
) | ||
#let almost-default-show-example = example.show-example.with( | ||
layout: example.default-layout-example.with( | ||
code-block: block.with(stroke: .5pt + luma(200)), | ||
col-spacing: 0pt | ||
) | ||
) | ||
|
||
#set block(below: 0pt) | ||
|
||
// All possible combinations of code and markup mode | ||
#show-example(`1`) | ||
#show-example(`#calc.sin(0)`) | ||
#show-example(raw("#calc.sin(0)")) | ||
#show-example(raw(lang: "typc", "calc.sin(0)")) | ||
#show-example(raw(lang: "typc", "calc.sin(0)", block: true)) | ||
#show-example(raw(lang: "typ", "#calc.sin(0)")) | ||
#show-example(raw(lang: "typ", "a^2"), mode: "math") | ||
#show-example(raw(lang: "typm", "a^2"), mode: "math") | ||
|
||
#pagebreak() | ||
|
||
// Check that `raw` is not forced to block in the preview, see #21 | ||
#show-example(`a #raw("foo") b`, mode: "markup") | ||
// Language should NOT default to typ in the preview, see #21 | ||
#show-example(`#raw("#import")`, mode: "markup") | ||
|
||
#pagebreak() | ||
|
||
#show-example(`Fit that code in a tiny space`) | ||
|
||
#pagebreak() | ||
|
||
// Test ratio | ||
#almost-default-show-example(`Ratio .5`, ratio: .5) | ||
#pagebreak() | ||
|
||
// Test scale-preview | ||
#almost-default-show-example(`Fit that 200%`, scale-preview: 200%) | ||
#almost-default-show-example(`Fit that 50%`, scale-preview: 50%) | ||
#pagebreak() | ||
|
||
|
||
// Test direction | ||
#almost-default-show-example(`#ltr`, dir: ltr) | ||
#pagebreak() | ||
#almost-default-show-example(`#ttb`, dir: ttb) | ||
|
||
#pagebreak() | ||
|
||
// The auto-shower, see #15 | ||
|
||
#[ | ||
#show: render-examples | ||
|
||
```example | ||
#rect(height: 3pt) | ||
``` | ||
] | ||
|
||
#pagebreak() | ||
|
||
|
||
#[ | ||
#set page(width: auto, height: auto, margin: 0pt) | ||
#show: render-examples.with(layout: (code, preview) => grid(columns: 2, align: horizon, code, preview)) | ||
|
||
```example | ||
#rect(height: 3pt) | ||
``` | ||
] |