diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7afbef7..c265312 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,12 +22,11 @@ gen` to generate a new manual and examples. The examples inside the docs currently don't make it easy to simplify this without generating them manually the whole time. Typst is missing a feature or plugin that allows embedding whole other -typst documents at the moment. +Typst documents at the moment. That being said, it's fine to leave this step out on a PR and have me generate it once the rest of the PR is done. -[typst]: https://github.com/typst/typst [typst-test]: https://github.com/tingerrr/typst-test [just]: https://just.systems/ [nushell]: https://www.nushell.sh/ diff --git a/README.md b/README.md index c8aea7a..ec43b0e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # hydra -Hydra is a [typst] package allowing you to easily display the heading like elements anywhere in your -document. In short, it will show you the currently active element only when it is not visible. +Hydra is a Typst package allowing you to easily display the heading like elements anywhere in your +document. It's primary focus is to provide the reader with a reminder of where they currently are in +your document only when it is needed. ## Example ```typst @@ -34,8 +35,10 @@ For a more in-depth description of hydra's functionality and the reference read ## Contribution For contributing, please take a look [CONTRIBUTING][contrib]. +## Etymology +The package name hydra /ˈhaɪdrə/ is a word play headings and headers, inspired by the monster in +greek and roman mythology resembling a serpent with many heads. + [ex]: examples/example.png [manual]: doc/manual.pdf [contrib]: CONTRIBUTING.md - -[typst]: https://github.com/typst/typst diff --git a/doc/manual.pdf b/doc/manual.pdf index 0e848ef..e200338 100644 Binary files a/doc/manual.pdf and b/doc/manual.pdf differ diff --git a/doc/manual.typ b/doc/manual.typ index 7ce4340..b707599 100644 --- a/doc/manual.typ +++ b/doc/manual.typ @@ -3,10 +3,9 @@ #show: project.with( package: package, + subtitle: [/ˈhaɪdrə/ \ Of headings and headers], date: datetime.today(), - abstract: [ - A package for querying and displaying heading-like elements. - ], + abstract: package.description, ) #[ diff --git a/doc/template.typ b/doc/template.typ index 8cd4196..fd2ef4c 100644 --- a/doc/template.typ +++ b/doc/template.typ @@ -17,7 +17,7 @@ v(4em) align(center, { - block(text(weight: 700, 1.75em, package.name)) + block(text(weight: 700, 1.75em, eastern, package.name)) if subtitle != none { block(subtitle) } @@ -56,7 +56,7 @@ show terms: set par(justify: false) show raw.where(block: true): set par(justify: false) - // abstract + // outline page({ show outline.entry: it => if it.level == 1 { strong(it) @@ -85,6 +85,8 @@ it } + show link: set text(eastern) + set table(stroke: none) show table: pad.with(x: 1em) diff --git a/tests/redundancy-block/test.typ b/tests/redundancy-block/test.typ new file mode 100644 index 0000000..90d63ec --- /dev/null +++ b/tests/redundancy-block/test.typ @@ -0,0 +1,39 @@ +// Synopsis: +// - both the first and second part of the document should give the same result +// - page 4 and 5 don't contain a header, just like 1 and 2 don't + +#import "/src/lib.typ": hydra + +#set page(header: context hydra()) + +#let inner = it => { + set text(2em, weight: "bold") + v(8em) + if it.numbering != none [ + Chapter #counter(heading).display() + #v(.5em) + ] + it.body + v(0.5em) +} + +#[ + #show heading.where(level: 1) : it => pagebreak(weak: true) + block(inner(it)) + = First + #hide[.] + + = Second + #hide[.] + #pagebreak() + #pagebreak() +] + +#[ + #show heading.where(level: 1) : it => pagebreak(weak: true) + inner(it) + = First Again + #hide[.] + + = Second Again + #hide[.] + #pagebreak() +]