diff --git a/.vscode/tasks.json b/.vscode/tasks.json index c250b17..0deceef 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,7 +4,7 @@ "version": "2.0.0", "tasks": [ { - "label": "watch", + "label": "watch demo", "type": "shell", "command": "typst", "args": [ @@ -18,6 +18,17 @@ "isDefault": true } }, + { + "label": "watch test", + "type": "shell", + "command": "typst", + "args": [ + "w", + "test/test.typ", + "--root", + "${workspaceFolder}" + ], + }, { "label": "compile themes", "type": "shell", diff --git a/CHANGELOG.md b/CHANGELOG.md index 2330e4a..78f96b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog 📝 +## [0.5.1] - 2023-10-21 + +### Fixed + +* Fixed height with empty newline + ## [0.5.0] - 2023-09-29 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e528d52..34005eb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,6 @@ Thank you for your interest in contributing to this project! This document outli 2. Add your theme to the `terminal-themes` directory. 3. Add theme preview to the `test/themes.typ` file. 4. Make sure you have `Cascadia Code` font installed and compile the `test/themes.typ` file (you can use `compile themes` task in VS Code). -5. Make sure you're not committing `ansi-render.pdf` file. ## Code formatting diff --git a/README.md b/README.md index 9f6f621..06eaab3 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ contribution is welcomed! above: relative length or fraction, below: relative length or fraction, clip: boolean, - theme: terminal-themes.theme, bold-is-bright: boolean, + theme: terminal-themes.theme, ) ``` @@ -46,8 +46,8 @@ contribution is welcomed! - `string` - string with ANSI escape sequences - `font` - font name or none, default is `Cascadia Code`, set to `none` to use the same font as `raw` - `size` - font size, default is `1em` -- `theme` - theme, default is `vscode-light` - `bold-is-bright` - boolean, whether bold text is rendered with bright colors, default is `false` +- `theme` - theme, default is `vscode-light` - parameters from [`block`](https://typst.app/docs/reference/layout/block/) function with the same default value, only affects outmost block layout: - `width` - `height` diff --git a/test/demo.pdf b/test/demo.pdf index 9d0483e..ac08ac1 100644 Binary files a/test/demo.pdf and b/test/demo.pdf differ diff --git a/test/demo.typ b/test/demo.typ index 42ffda3..b09a1ba 100644 --- a/test/demo.typ +++ b/test/demo.typ @@ -54,18 +54,3 @@ ansi-render(bold-bright-test, theme: terminal-themes.vintage), ansi-render(bold-bright-test, theme: terminal-themes.vintage, bold-is-bright: true), ) - -= Render empty newlines -#ansi-render( -" - - -3 empty lines above - - - -3 empty lines below - - -" -) \ No newline at end of file diff --git a/test/test.pdf b/test/test.pdf new file mode 100644 index 0000000..291d2f3 Binary files /dev/null and b/test/test.pdf differ diff --git a/test/test.typ b/test/test.typ new file mode 100644 index 0000000..c2f0304 --- /dev/null +++ b/test/test.typ @@ -0,0 +1,19 @@ +#import "../ansi-render.typ": ansi-render as __ansi-render, terminal-themes + +// workaround before set is implemented +#let ansi-render = __ansi-render.with(inset: 5pt, radius: 3pt, theme: terminal-themes.vscode) + +// newline with background color +#ansi-render( +"\u{1b}[101mHello + + +World") + +// Render empty newlines +#grid( + columns: (auto, auto), + column-gutter: 1pt, + ansi-render("\n\n\n\n\n"), + ansi-render("1\n2\n3\n4\n5\n6"), +) \ No newline at end of file diff --git a/typst.toml b/typst.toml index d8edcaa..5ed0b3b 100644 --- a/typst.toml +++ b/typst.toml @@ -1,6 +1,6 @@ [package] name = "ansi-render" -version = "0.5.0" +version = "0.5.1" entrypoint = "ansi-render.typ" authors = ["8LWXpg"] license = "MIT"