Quickstart
Print semantic lines, a verdict and a small report – in Rust and in Node.
Semantic lines and verdicts
use runemark::{ColorMode, Console, Tone, Verdict};
let console = Console::stdout(ColorMode::Auto);
println!("{}", console.paint(Tone::Title, "site audit"));
println!("{}", console.paint(Tone::Warning, "3 findings need review"));
println!("{}", Verdict::Passed.render(console, "Configuration validated cleanly"));const { RunemarkConsole, renderStatus } = require('@casoon/runemark')
const console = new RunemarkConsole({ color: 'auto' })
console.writeInfo('Starting site audit')
console.writeWarning('3 findings need review')
process.stdout.write(`${renderStatus('passed', 'Configuration validated cleanly')}\n`)Auto emits styles only to an interactive terminal and honours NO_COLOR. Use Never in tests
and snapshots. See Colour policy.
A first report
Reports are built from your own data. runemark never defines domain-specific finding types.
use runemark::{ColorMode, Console, Finding, FindingGroup, Report, Tone, Verdict};
let report = Report::new("Site audit", Verdict::Warning).add_group(
FindingGroup::new("Accessibility")
.add_finding(Finding::new(Tone::Warning, "Image has no text alternative")),
);
print!("{}", report.render(Console::stdout(ColorMode::Auto)));const { RunemarkReport } = require('@casoon/runemark')
const report = new RunemarkReport({
schemaVersion: 1,
title: 'Site audit',
verdict: 'warning',
groups: [
{
title: 'Accessibility',
findings: [{ message: 'Image has no text alternative', tone: 'warning' }],
},
],
})
process.stdout.write(report.render({ color: 'auto', width: process.stdout.columns }))Next: the Reports guide covers metrics, detail levels and widths.