jneug / typst-mantys

Template for documenting Typst Packages and Templates.
MIT License
40 stars 5 forks source link

Mantys (v0.1.4)

MANuals for TYpSt

Template for documenting typst packages and templates.

Usage

Just import the package at the beginning of your manual:

#import "@preview/mantys:0.1.4": *

Mantys supports Typst 0.11.0 and newer.

Writing basics

A basic template for a manual could look like this:

#import "@local/mantys:0.1.4": *

#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.
    ],

    example-imports: (your-package: 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:

#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

For a full reference of available commands read the manual.

Changelog

Version 0.1.5

Version 0.1.4

Version 0.1.3

Version 0.1.2

Version 0.1.1

Version 0.1.0

Version 0.0.4

Breaking changes

Version 0.0.3

Version 0.0.2

Version 0.0.1