Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mantys:1.0.0 #1498

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/preview/mantys/1.0.0/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Jonas Neugebauer

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.
158 changes: 158 additions & 0 deletions packages/preview/mantys/1.0.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Mantys (v1.0.0)

> **MAN**uals for **TY**p**S**t

Template for documenting [Typst](https://github.com/typst/typst) packages and templates.

## Usage

Quickstart your manual using `typst init`:
```shell
typst init @preview/mantys
```

## Writing basics

A basic template for a manual could looks like this:

```typst
#import "@local/mantys:1.0.0": *

#import "your-package.typ"

#show: mantys.with(
name: "your-package-name",
title: [A title for the manual],
subtitle: [A subtitle for the manual],
info: [A short descriptive text for the package.],
authors: "Your Name",
url: "https://github.com/repository/url",
version: "0.0.1",
date: "date-of-release",
abstract: [
A few paragraphs of text to describe the package.
],

examples-scope: (
scope: (your-package: your-package),
imports: (your-package: "*")
)
)

// end of preamble

= About
#lorem(50)

= Usage
#lorem(50)

= Available commands
#lorem(50)

```

Use `#command(name, ..args)[description]` to describe commands and `#argument(name, ...)[description]` for arguments:

```typst
#command("headline", arg[color], arg(size:1.8em), sarg[other-args], barg[body])[
Renders a prominent headline using #doc("meta/heading").

#argument("color", type:"color")[
The color of the headline will be used as the background of a #doc("layout/block") element containing the headline.
]
#argument("size", default:1.8em)[
The text size for the headline.
]
#argument("sarg", is-sink:true)[
Other options will get passed directly to #doc("meta/heading").
]
#argument("body", type:"content")[
The text for the headline.
]

The headline is shown as a prominent colored block to highlight important news articles in the newsletter:

#example[```
#headline(blue, size: 2em, level: 3)[
#lorem(8)
]
```]
]
```

The result might look something like this:

![Example for a headline command with Mantys](docs/assets/headline-example.png)

For a full reference of available commands read [the manual](docs/manual.pdf).

## Changelog

### Version 1.0.0

Version 1.0.0 is a complete rewrite of Mantys with many breaking changes. Read the [the manual](docs/manual.pdf) for a full usage reference.

### Version 0.1.4

- Fix missing links in outline (@tingerrr).
- Fixed problem when evaluating default values with Tidy.

### Version 0.1.3

- Fix for some datatypes not being displayed properly (thanks to @tingerrr).
- Fix for imbalanced outline columns (thanks again to @tingerrr).

### Version 0.1.2

- Added [hydra](https://typst.app/universe/package/hydra) for better detection of headings in page headers (thanks to @tingerrr for the suggestion).
- Fixed problem with multiple quotes around default string values in tidy docs.
- Fixed datatypes linking to wrong documentation urls.

### Version 0.1.1

- Added template files for submission to _Typst Universe_.

### Version 0.1.0

- Refactorings and some style changes
- Updated manual.
- Restructuring of package repository.

### Version 0.0.4

- Added integration with [tidy](https://github.com/Mc-Zen/tidy).
- Fixed issue with types in argument boxes.
- `#lambda` now uses `#dtype`

#### Breaking changes

- Adapted `scope` argument for `eval` in examples.
- `#example()`, `#side-by-side()` and `#shortex()` now support the `scope` and `mode` argument.
- The option `example-imports` was replaced by `examples-scope`.

### Version 0.0.3

- It is now possible to load a packages' `typst.toml` file directly into `#mantys`:
```typst
#show: mantys.with( ..toml("typst.toml") )
```
- Added some dependencies:
- [jneug/typst-tools4typst](https://github.com/jneug/typst-tools4typst) for some common utilities,
- [jneug/typst-codelst](https://github.com/jneug/typst-codelst) for rendering examples and source code,
- [Pablo-Gonzalez-Calderon/showybox-package](https://github.com/Pablo-Gonzalez-Calderon/showybox-package) for adding frames to different areas of a manual (like examples).
- Redesign of some elements:
- Argument display in command descriptions,
- Alert boxes.
- Added `#version(since:(), until:())` command to add version markers to commands.
- Styles moved to a separate `theme.typ` file to allow easy customization of colors and styles.
- Added `#func()`, `#lambda()` and `#symbol()` commands, to handle special cases for values.
- Fixes and code improvements.

### Version 0.0.2

- Some major updates to the core commands and styles.

### Version 0.0.1

- Initial release.
24 changes: 24 additions & 0 deletions packages/preview/mantys/1.0.0/docs/assets.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#let assets = (
"theme-cnltx-pages": (
src: "assets/examples/theme-cnltx-pages.typ",
dest: "assets/examples/theme-cnltx-pages/{n}.png",
),
"assets/examples/theme-cnltx.png": "assets/examples/theme-cnltx.typ",
"theme-modern-pages": (
src: "assets/examples/theme-modern-pages.typ",
dest: "assets/examples/theme-modern-pages/{n}.png",
),
"assets/examples/theme-modern.png": "assets/examples/theme-modern.typ",
"theme-typst-pages": (
src: "assets/examples/theme-typst-pages.typ",
dest: "assets/examples/theme-typst-pages/{n}.png",
),
"assets/examples/theme-typst.png": "assets/examples/theme-typst.typ",
"theme-orly-pages": (
src: "assets/examples/theme-orly-pages.typ",
dest: "assets/examples/theme-orly-pages/{n}.png",
),
"assets/examples/theme-orly.png": "assets/examples/theme-orly.typ",
"assets/examples/headline.png": "assets/examples/headline.typ",
"assets/thumbnail.png": "assets/thumbnail.typ",
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions packages/preview/mantys/1.0.0/docs/assets/examples/headline.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#import "../../../src/core/document.typ"
#import "../../../src/core/layout.typ"
#import "../../../src/core/themes.typ"
#import "../../../src/api/commands.typ": *
#import "../../../src/api/examples.typ": example

#show: layout.page-init(
document.create(
title: "typst-test",
..toml("../../../typst.toml"),
),
themes.default,
)
#set page(width: 18cm, height: auto, margin: 1em)


#let headline(color, size: 1.8em, body, ..other-args) = block(
fill: color,
width: 100%,
inset: .5em,
radius: 4pt,
heading(..other-args, text(size, white, body)),
)


#command("headline", arg("color"), arg(size: 1.8em), barg("body"), sarg("other-args"))[
Renders a prominent headline using #builtin[heading].

#argument("color", types: color)[
The color of the headline will be used as the background of a block element containing the headline.
]
#argument("size", default: 1.8em)[
The text size for the headline.
]
#argument("other-args", is-sink: true, types: "any")[
Other options will get passed directly to #builtin[heading].
]
#argument("body", types: (content, str))[
The text for the headline.
]

The headline is shown as a prominent colored block to highlight important news articles in the newsletter:
#example(use-examples-scope: false, scope: (headline: headline))[```
#headline(blue, size:16pt, level:3, numbering: none)[
#lorem(4)
]
```]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#import "../../../src/mantys.typ": *

#show: mantys(
name: "mantys",
version: "1.0.0",
authors: (
"Jonas Neugebauer",
),
license: "MIT",
description: "Helpers to build manuals for Typst packages.",
repository: "https://github.com/jneug/typst-mantys",

/// Uncomment to load the above package information
/// directly from the typst.toml file
// ..toml("../typst.toml"),

title: "Manual title",
// subtitle: "Tagline",
date: datetime.today(),

// url: "",

abstract: [
#lorem(50)
],

show-index: false,

theme: themes.cnltx
)


#heading(depth: 1, "Heading")
#lorem(300)


#heading(depth: 2, "Heading")
#lorem(300)


#heading(depth: 2, "Heading")
#lorem(300)

#heading(depth: 1, "Heading")
#lorem(300)
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#set page(width: auto, height: auto, margin: 2mm, fill: luma(96%))

#let page-count = 2
#grid( columns: page-count, gutter: 2mm, ..for i in range(page-count) {
(image("theme-cnltx-pages/" + str(i + 1) + ".png", width: 2cm),)
} )
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#import "../../../src/mantys.typ": *

#show: mantys(
name: "mantys",
version: "1.0.0",
authors: (
"Jonas Neugebauer",
),
license: "MIT",
description: "Helpers to build manuals for Typst packages.",
repository: "https://github.com/jneug/typst-mantys",

/// Uncomment to load the above package information
/// directly from the typst.toml file
// ..toml("../typst.toml"),

title: "Manual title",
// subtitle: "Tagline",
date: datetime.today(),

// url: "",

abstract: [
#lorem(50)
],

show-index: false,

theme: themes.modern
)


#heading(depth: 1, "Heading")
#lorem(300)


#heading(depth: 2, "Heading")
#lorem(300)


#heading(depth: 2, "Heading")
#lorem(300)

#heading(depth: 1, "Heading")
#lorem(300)
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#set page(width: auto, height: auto, margin: 2mm, fill: luma(96%))

#let page-count = 2
#grid( columns: page-count, gutter: 2mm, ..for i in range(page-count) {
(image("theme-modern-pages/" + str(i + 1) + ".png", width: 2cm),)
} )
Loading
Loading