-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 584fbc5
Showing
16 changed files
with
2,063 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,68 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
tests: | ||
strategy: | ||
matrix: | ||
typst-version: ["0.12"] | ||
# the docs don't need to build with all versions supported by the package; | ||
# the latest one is enough | ||
# include: | ||
# - typst-version: "0.12" | ||
# doc: 1 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Probe runner package cache | ||
uses: awalsh128/cache-apt-pkgs-action@v1 | ||
with: | ||
packages: imagemagick cargo | ||
version: 1.0 | ||
|
||
- name: Install oxipng from crates.io | ||
uses: baptiste0928/cargo-install@v3 | ||
with: | ||
crate: oxipng | ||
|
||
- name: Install just from crates.io | ||
uses: baptiste0928/cargo-install@v3 | ||
with: | ||
crate: just | ||
|
||
- name: Install typst-test from github | ||
uses: baptiste0928/cargo-install@v3 | ||
with: | ||
crate: typst-test | ||
git: https://github.com/tingerrr/typst-test.git | ||
tag: ci-semi-stable | ||
|
||
- name: Setup typst | ||
id: setup-typst | ||
uses: typst-community/setup-typst@v3 | ||
with: | ||
typst-version: ${{ matrix.typst-version }} | ||
|
||
- name: Run test suite | ||
run: just test | ||
|
||
- name: Archive diffs | ||
uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: typst-${{ steps.setup-typst.outputs.typst-version }}-diffs | ||
path: | | ||
tests/**/diff/*.png | ||
tests/**/out/*.png | ||
tests/**/ref/*.png | ||
retention-days: 5 | ||
|
||
- name: Build docs | ||
if: ${{ matrix.doc }} | ||
run: just doc |
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,2 @@ | ||
tests/*/out | ||
tests/*/diff |
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,12 @@ | ||
# [unreleased](https://github.com/wisp3rwind/typst-guide-lines/releases/tag/<tag>) | ||
|
||
## Added | ||
|
||
## Removed | ||
|
||
## Changed | ||
|
||
## Migration Guide from v0.1.x | ||
|
||
# [v0.1.0](https://github.com/wisp3rwind/typst-guide-lines/releases/tag/v0.1.0) | ||
Initial release |
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,24 @@ | ||
root := justfile_directory() | ||
|
||
export TYPST_ROOT := root | ||
|
||
|
||
[private] | ||
default: | ||
@just --list --unsorted | ||
|
||
# run reference tests | ||
test *args: | ||
typst-test run {{ args }} | ||
|
||
# update reference tests | ||
update *args: | ||
typst-test update {{ args }} | ||
|
||
# compile examples for README to svg | ||
examples: | ||
for f in "{{ root }}/docs"/*.typ; do rm -f "${f/.typ/}"-*.svg; typst compile "$f" "${f/.typ/-p\{0p\}.svg}"; done | ||
|
||
# install the package into the specified target folder (which may be @local) | ||
install target="@local": | ||
./scripts/install "{{target}}" |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 wisp3rwind | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,39 @@ | ||
# The `guide-lines` Package | ||
|
||
Show borders around the main text area, header and footer in Typst documents. | ||
|
||
This may be useful to understand and debug layout issues. | ||
The idea is similar to the LaTeX [`layout`](https://ctan.org/pkg/layout) | ||
package. | ||
|
||
## Usage | ||
|
||
```typst | ||
#import "@preview/guide-lines:v0.1.0": background | ||
#set page(paper: "a6") | ||
#set page(background: background()) | ||
#lorem(100) | ||
#pagebreak() | ||
#set page(background: background(stroke: blue + 1pt)) | ||
#lorem(100) | ||
``` | ||
|
||
![Output of the usage example, page 1](/docs/example-1-p1.svg) ![Output of the usage example, page 2](/docs/example-1-p2.svg) | ||
|
||
## Known issues | ||
|
||
The following limitations are known, PRs to address them are always welcome!: | ||
|
||
- If `page.margin` contains the `inside` or `outside` keys, and `page.binding` | ||
is set to `auto`, the package will currently assume an LTR document with | ||
binding on the left side. It would be correct to follow Typst and determine | ||
the binding according to the text direction. | ||
|
||
## Acknowledgements | ||
The following Typst issues and forum post inspired this package and informed | ||
its design and implementation: | ||
|
||
- https://github.com/typst/typst/issues/5311 |
Oops, something went wrong.