Crate ftml

source ·
Expand description

A library to parse Wikidot text and produce an abstract syntax tree (AST).

This library aims to be a replacement of Wikidot’s Text_Wiki parser, which is presently a loose group of regular expressions (with irregular Perl extensions). The aim is to provide an AST while also maintaining the flexibility and lax parsing that Wikidot permits.

The overall flow is the following:

  • Run messy includer
  • Run preprocessor
  • Run tokenizer
  • Run parser
  • Run renderer

Each step of the flow makes extensive use of Rust’s borrowing capabilities, ensuring that as few allocations are performed as possible. Any strings which are unmodified are passed by reference. Despite this, all of the exported structures are both serializable and deserializable via serde.

Rendering is performed by the trait Render. There are two main implementations of note, TextRender and HtmlRender, which render to plain text and full HTML respectively.

§Features

This crate has one feature of note:

The mathml feature pulls in the latex2mathml library, which renders LaTeX blocks using MathML. It is enabled by default.

§Targets

The library supports being compiled into WebAssembly. (target wasm32-unknown-unknown, see wasm-pack for more information)

Compiling to wasm also disables all FFI integration, since these are inherently incompatible.

§Bugs

If you discover any bugs or have any feature requests, you can submit them via our Atlassian helpdesk here.

Alternatively, you can get in touch with Wikijump developers directly.

Re-exports§

Modules§

Structs§

Functions§

  • Run the preprocessor on the given wikitext, which is modified in-place.