Crates.io | literate |
lib.rs | literate |
version | 0.5.1 |
source | src |
created_at | 2022-01-13 21:32:02.73587 |
updated_at | 2022-01-17 03:54:54.227667 |
description | A literate programming tool that extracts code written in your Markdown files. |
homepage | https://github.com/misalcedo/literate-rs |
repository | https://github.com/misalcedo/literate-rs |
max_upload_size | |
id | 513550 |
size | 55,423 |
A literate programming tool that allows writing code in your Markdown files.
At its core literate
reads a file from standard in and outputs code blocks to standard out as a single stream.
The code blocks may be filtered by various qualities such as language, attributes, etc.
Although literate
itself is very simple, the magic really happens when you apply the tool to entire directories.
For example, a Rust project could add literate to their build.rs
in order to write their examples as Markdown files that become Rust files at build time.
Since Rust has a very mature documentation culture, the actual source may not benefit as much from literate
.
However, one can easily envision a tool that flips Rust's documentation on its head.
Instead of doc comments, Rust source could be defined as Markdown files.
During build, the file could be parsed to add the surrounding text as a doc comment to the code block code.
User's could plug in different strategies for traversing up the tree to find the relevant documentation.
cat .\examples\tortuga.ta.md | literate --language tortuga --required