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 (legacy Wikidot)
- 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§
pub use self::includes::include;
pub use self::parsing::parse;
pub use self::preproc::preprocess;
pub use self::tokenizer::tokenize;
pub use self::tokenizer::Tokenization;
Modules§
- data
- This module defines POD (plain old data) structs.
- includes
- This module implements “messy includes”, or legacy Wikidot includes.
- info
- This module has build and meta information about the library.
- layout
- parsing
- prelude
- This module collects commonly used traits from this crate.
- preproc
- This module mimics the Wikidot preprocessor, which replaces certian character sequences to make them look better, or be easier to parse.
- render
- settings
- tokenizer
- tree