Practical, copy-paste recipes for common document and data tasks.
Convert a Markdown file to a standalone HTML page.
lambda convert readme.md -t html -o readme.html
Convert JSON data to YAML format.
lambda convert data.json -t yaml -o data.yaml
Convert YAML configuration to JSON.
lambda convert config.yaml -t json -o config.json
Convert LaTeX documents to styled HTML.
lambda convert paper.tex -t html -o paper.html --full-document
Parse XML into the Lambda tree and output as JSON.
lambda convert data.xml -f xml -t json -o data.json
Convert CSV tabular data to structured JSON.
lambda convert data.csv -t json -o data.json
Define a schema and validate JSON files against it.
// schema.ls
type User = {
name: string,
age: int that (0 <= ~ <= 150),
email: string?
}
lambda validate users.json -s schema.ls
HTML files are validated against the built-in HTML5 schema automatically.
lambda validate page.html
Strict mode: all optional fields must be present or null.
lambda validate config.yaml -s config_schema.ls --strict
Render an HTML page to SVG output.
lambda render page.html -o output.svg
Render an HTML page to a PDF document.
lambda render page.html -o output.pdf
Take a high-DPI screenshot of an HTML page.
lambda render page.html -o screenshot.png \
-vw 1920 -vh 1080 --pixel-ratio 2.0
Render a Mermaid diagram to SVG with a dark theme.
lambda render diagram.mmd -o diagram.svg -t github-dark
Open any document in the native viewer window.
lambda view page.html
lambda view readme.md
lambda view https://example.com
Use pipes and for-expressions to query JSON files.
// filter_users.ls
let users = input("users.json", 'json')
// Active users, sorted by age, top 10
for (u in users
where u.active
order by u.age desc
limit 10)
{name: u.name, age: u.age}
lambda filter_users.ls
Query the document tree for all image elements.
// images.ls
let doc = input("readme.md", 'markdown')
doc?<img> | ~.src
lambda images.ls
Read CSV, filter rows, and output as JSON.
// csv_filter.ls
let data = input("sales.csv", 'csv')
let big = data that ~.amount > 1000
format(big, 'json')
lambda csv_filter.ls