Flexible Latex-like Markup is a markup language strongly inspired by LaTeX' syntax.
Skip the boilerplate and type content. You type what looks like a simplified version of latex, without all the noise. FLM typesets your documents directly to outputs such as HTML, pdf. You can also directly generate self-contained latex code that latex will parse correctly. You control the final document's appearance through custom settings (you can set them in FLM's live preview settings editor), through custom templates, or by exporting your document to latex code that you can use in your favorite latex workflow.
If you know LaTeX, you'll find the syntax familiar and intuitive—you type
\textbf{..}, \section{Introduction}, \ref{eq:fancy},
\cite{arXiv:1211.1037}. (Yes, citations of the form arXiv:ID and doi:ID
are automatically resolved from arXiv.org and doi.org.)
FLM is a library that aims to offer great flexibility, as well as a command-line program. The command-line program can open a live preview in your browser, giving you an easy way to edit your documents interactively.
FLM is built on techy, a parsing library for latex-like syntax. techy is itself a rust rewrite of pylatexenc, a latex parsing library that I've been tinkering with for a while. We use FLM in the Error Correction Zoo, making use of its flexibility along with a precise yet intuitive syntax.
FLM was initially written in python (see the main-py branch of this repo). The
python version is now archived and will no longer be maintained.
FLM is still in experimental development status. Its API might change, and FLM syntax and FLM documents' front matter keys might have to be tweaked (we'll do our best to avoid that, though).
Security note: Process only documents that you trust. A document can make
flm read any file that you can read via \input, via its images, and through
files you specify in its settings (such as a bibliography database file). A
document can also execute extensions, including those found in a folder named
_flmextensions beside the document. An extension written in JavaScript or
compiled to WebAssembly can runs arbitrary code, and flm lets such an
extension start any program on your machine. Audit any extensions before using
them! (We'll probably build some safeguards in, but we want to make sure they
won't get in the user's way in their everyday use. For now, be careful.
Remember, no warranties.)
Binaries are available for download on github's release page: https://github.com/phfaist/flm/releases
(Note: macOS won't let you run these binaries because they are not signed; run
xattr -d com.apple.quarantine flm to bypass macOS' quarantine.)
If you have a rust toolchain set up, you can also directly install flm by typing
cargo install flm.
A document resembles a LaTeX document, but with a special front matter block:
---
title: 'Surface Code'
author: 'Author Name'
date: 'Dec. 2022'
---
\section{Kitaev's Surface Code}
The \emph{stabilizers} of the \textit{surface code} on the 2-dimensional
torus are generated by star operators \(A_v\) and plaquette operators
\(B_p\). Each star operator is a \textbf{product} of four Pauli-\(X\)
operators on the edges adjacent to a vertex \(v\) of the lattice; each
plaquette operator is a product of four Pauli-\(Z\) operators applied to
the edges adjacent to a face, or plaquette, \(p\) of the
6E4B
lattice
(\ref{figure:toric-code-operators}).
\begin{figure}
\includegraphics{toric-code-operators.svg}
\caption{Stabilizer generators and logical operators of the 2D surface
code on a torus. The star operators \(A_v\) and the plaquette
operators \(B_p\) generate the stabilizer group of the toric code.
The logical operators are strings that wrap around the torus.}
\label{figure:toric-code-operators}
\end{figure}
...
Type flm surface-code.flm and open the link it prints in your browser. You'll
see a live preview of the document, which updates as you update your
surface-code.flm document. You can also play around with the FLM settings
using the in-browser preview app's visual settings editor (change the template,
loaded packages/features, change the numbering scheme for headings, figures,
etc.).
The guide's chapter FLM language syntax describes how a document is written, and the chapter std flm the constructs that every FLM document may use.
flm info describes what a document can use: the packages, the commands each feature
declares (how each is written and what each argument holds), the settings with their
values in effect, the workflows and their processing steps. It prints pages of
documentation at the terminal, or JSON with --json:
flm info # the environment at a glance
flm info '\section' # how \section is written, and its arguments
flm info -d paper.flm settings/ # the settings in effect for paper.flm
flm info --json features/refs # one page as JSONThe command is built on the crate flm-info, which a program can use to describe an FLM
environment itself. With --json-messages, every command but flm dump writes its messages (the
problems it finds, its log lines and the progress of a build) as JSON lines on standard error, for an
editor or another program to read.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.