Giter Site home page Giter Site logo

mdbook-typst's Introduction

mdbook-typst

mdbook preprocessor to add typst support

Installation

cargo install --git https://github.com/duskmoon314/mdbook-typst
# OR
git clone https://github.com/duskmoon314/mdbook-typst.git
cargo build --release

Usage

Setup preprocessor

Add the following to your book.toml:

[preprocessor.typst]
# If installed via cargo build
command = "/path/to/mdbook-typst"

Control the style

Add css to control the style of the typst block:

/* css/typst.css as an example */
.typst-wrapper {
    display: flex;
    justify-content: center;
}

.typst-doc {
    transform: scale(1.75);
}

Add the following to your book.toml:

[output.html]
additional-css = ["css/typst.css"]

What this preprocessor does

This preprocessor will convert all code blocks with the language typst to a <div> with the class typst-wrapper and a <svg> with the class typst-doc inside.

Say you have the following code block in your markdown:

    hello
    ```typst
    y = f(x)
    ```
    world

This preprocessor will first change it to:

    hello
    ```typst
+   #set page(width:auto, height:auto, margin:0.5em)
    y = f(x)
    ```
    world

Then preprocessor will convert it to:

hello
<div class="typst-wrapper">
    <svg class="typst-doc" ...></svg>
</div>
world

TODO

  • Integrate typst in code instead of using std::process::Commend
  • Allow user to configure the preambles through book.toml

mdbook-typst's People

Contributors

duskmoon314 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.