Repository navigation
v1.0.0
The 1.0.0 hardening release. Everything under Breaking needs a change in code that
calls the API; MIGRATION.md shows each one, before and after. Issue
numbers are in micheltlutz/molt.
Breaking
Nodeis#[non_exhaustive], andNode::Text,Node::RawandNode::Commenthold a
Markup, a string with no public constructor.Node::Text("<script>".into())no longer
compiles; build nodes withNode::text(escapes),Node::comment(neutralises) and
Node::raw(the greppable hatch). AmatchonNodeneeds a_arm.
(#13,
#14)#[non_exhaustive]onRole,A11yIssue,RenderOptions,Document,SitemapUrl,
RssItemandRssGenerator: build them with their constructors, not struct literals.RenderOptions::indentis private. Read it withindent();with_indentkeeps only
spaces and tabs, at most 16. (#28)Layout::renderandLayout::render_manyarewrapandwrap_many, because they
collided withRender::render. (#18)escape_text,escape_text_with_slashes,escape_attributeandescape_xmlreturn
Cow<str>, borrowed when nothing needed escaping.
(#21)VOID_TAGSandWHITESPACE_SENSITIVE_TAGSare&[&str], not arrays with a length.
(#16)SitemapUrl::changefreqtakes aChangeFreqinstead of text;priorityis clamped to
0.0..=1.0. (#20)StaticSiteGeneratorreturnsSsgError, notio::Error. It converts into
io::Error, so?in a function returningio::Resultstill works.
(#19)- WASM:
child,addHeadandaddBodytake their element by value, which consumes
the JavaScript handle; using it afterwards throwsnull pointer passed to rust.
(#23) - The
parallelfeature impliesssg. (#22)
Security
Output now differs in the cases below, on purpose; each is also a row in the Output changes
table of MIGRATION.md.
- Comments can no longer close early.
Node::comment("x--->")used to leave a-->
that ended the comment and let the rest through as markup. (#2) - Tag names are validated.
Element::new("img src=x onerror=alert(1)")was written
verbatim, also from JavaScript throughnew WElement(str). An element whose tag is not a
letter followed by letters, digits,-,_,.or:is not rendered.
(#3) <and>in attribute values are escaped under raw-text ancestors (noscript,
iframe,xmp,noembed,noframes,script,style,plaintext), where
</noscript>inside analtended the parent. Elsewhere the byte-for-byte output is
unchanged. (#5)meta_name,meta_property,meta_charsetandmeta_http_equivescape their
values. (#4)StaticSiteGenerator: refuses symlinks on the way, paths that name no file ("",
.,a/) and Windows drive prefixes; writes through unique temporary files (two pages
with the same stem used to share one);copy_assetno longer deletes before it copies;
cleanrefuses., the working directory and its ancestors,$HOMEand top-level
directories. (#6,
#7,
#8)- URL policy: also covers
ping,manifest,longdescand, per candidate,srcset;
srcdocis written empty unlesstrusted_url; oniframe,frame,embedandobject
adata:URL passes only if it is a raster image.is_blocked_in(tag, …)is the new
tag-aware form. (#25) - XML:
escape_xmldrops the characters XML 1.0 cannot hold; a sitemap<loc>or feed
<link>that is not an absolutehttp(s)URL is left out;isPermaLink="true"is written
only for anhttp(s)guid. (#27) RenderOptions::with_max_depthdrops elements nested deeper than a limit, which is what
bounds pretty output (quadratic in depth). (#28)- CI and release: every action pinned to a commit SHA, read-only default token,
persist-credentials: false, job timeouts, and a release that refuses a tag that is not
onmainor has no green CI run. (#29)
Fixed
Document::render,accessibility::audit,Node::is_empty,Clone,PartialEqand
Hashrecursed once per level and aborted the process on a deep tree that the renderer
handled. All are iterative now, tested at 100,000 levels.
(#9,
#10,
#11)Debugis still recursive.SECURITY.mdand the WASM docs described a 256-level limit and a function name that did
not exist. (#12)
Added
Markup,SsgError,ChangeFreqandParseChangeFreqError.seo::json_ld,seo::script_jsonandescape_json_script: JSON that is safe inside a
<script>, where HTML escaping would corrupt it and no escaping would let</script>
through. WASMjsonLd. (#26)Element::from_static,RenderOptions::{indent, with_max_depth},
core::tags::is_valid_tag_name,core::url_policy::{is_http_url, is_blocked_in},
sitemap::{MAX_URLS, MAX_BYTES, SitemapGenerator::chunks}.- Trait impls:
DisplayforNode,ElementandDocument({:#}pretty-prints);
Hash;DefaultforDocument;FromIteratorforNode;ExtendforElement;
From<Vec<Node>>,From<Option<T>>andFrom<char>forNode;Renderfor&T,
Box<T>andOption<T>. (#17) - WASM:
WDocument.addSeo,WDocument.renderWithOptions, and onWElementaddClasses,
rawChild,selfClosing,renderWithOptionsandrenderBytes.
(#24) .claude/skills/molt: a knowledge base for agents (security, Rust practice, performance,
design patterns, governance, a decision log) whose lessons name the tests that guard them;
scripts/check-knowledge-base.shchecks that those still exist.tests/allocations.rspins allocation counts and type sizes; the benchmarks run at
opt-level = 3and no longer time theDrop.
Changed
-
Tag names and attribute keys are
Cow<'static, str>internally;div()makes no
allocation.Element::newandAttribute::newstill takeimpl Into<String>.
(#15) -
html!formats interpolated values straight into their escaped form: 40% faster to
build, with the same tree. -
Escapers copy the clean stretches between special characters in one step: prose-like text
is about twice as fast, and text where every other character needs escaping about 2.8×
slower (still ~400 MB/s). -
Attribute::rawis documented as one of the three escape hatches, with the reason. -
The published crate leaves out development tooling:
rust-toolchain.toml(it made rustup
install a wasm target and extra components for anyone building inside the unpacked tarball),
AGENTS.md,CLAUDE.md,clippy.toml,rustfmt.toml,deny.tomlandcodecov.yml. The
tests run from the extracted tarball: 480 pass. -
core::url_policy::is_http_urlno longer ignores leading whitespace. It is an allow list
used to decide what a sitemap or feed may link to, and a reader that does not trim would
read"\thttps://…"as a relative path. -
CI builds the documentation the way docs.rs does (nightly, every feature,
--cfg docsrs). -
CI now tests the minimum supported Rust version for real. The
1.85legs of the test
matrix had been running on stable: the repository'srust-toolchain.tomloverrides the
toolchain the setup action installs. They now setRUSTUP_TOOLCHAINand fail ifrustcis
not the version asked for. The claim held (all tests pass on 1.85.1), but nothing had proved it. -
tests/invariants.rs: property tests that run the escapers, the URL policy, the tag and
attribute writers, the XML generators and the static site generator on tens of thousands of
hostile inputs per run, from a fixed seed, on every platform.
Not changed, deliberately
panic = "abort", the three HTML/XML escapers, escape_attribute leaving < and > alone
outside raw-text ancestors, and the golden fixtures. Four tests were added after the fact
because they were claimed but missing (#57).
Install
[dependencies]
molt-framework = "1.0.0"The library is imported as molt: use molt::prelude::*;
What's Changed
- Docs: README linka o crates.io, remove Brand e cita o port 3.0.1 by @micheltlutz in #43
- Fix: comentário não fecha mais com ---> (S1) by @micheltlutz in #44
- Fix: nome de tag inválido não é mais escrito no HTML (S2) by @micheltlutz in #45
- Fix: < e > em atributos são escapados sob ancestrais raw-text (S4) by @micheltlutz in #46
- Fix: valores dos helpers meta_* passam pelo escape de atributo (S3) by @micheltlutz in #47
- Fix: SSG recusa symlink, caminhos sem arquivo e clean() do cwd (S5, S6, B1) by @micheltlutz in #48
- Fix: Document, audit, Clone e PartialEq não recursam por nível (B2–B5) by @micheltlutz in #49
- Change: superfície pública do 1.0 — non_exhaustive, tags como slice, Layout::wrap (A1, A4, A6, A10) by @micheltlutz in #50
- Change: tag e chave de atributo como Cow<'static, str>; escape_* devolve Cow (A3, A9, P2) by @micheltlutz in #51
- Change: Node opaco (Markup) e traits comuns (A2, A5) by @micheltlutz in #52
- Change: SsgError tipado e ChangeFreq no sitemap (A7, A8) by @micheltlutz in #53
- Change: WASM recebe handles por valor e ganha addSeo e opções (W1, W2) by @micheltlutz in #54
- Test: benchmarks confiáveis e orçamentos de alocação (P0) by @micheltlutz in #55
- Perf: escapers copiam trechos limpos com push_str (P4) by @micheltlutz in #56
- Test: restaura os testes do S2 e S4 que nunca entraram by @micheltlutz in #57
- Docs: base de conhecimento de boas práticas de Rust para agentes by @micheltlutz in #58
- Perf: html! formata Display direto, sem to_string intermediário by @micheltlutz in #59
- Perf: trusted_url sem cópia da chave; teto de tamanho dos tipos (P3, P8) by @micheltlutz in #60
- Docs: README convida a contribuir e a apoiar pelo GitHub Sponsors by @micheltlutz in #62
- Fix: indent só aceita espaço e tab; RenderOptions::with_max_depth (S10) by @micheltlutz in #64
- Fix: XML sem caracteres ilegais, links http(s), isPermaLink verdadeiro (S9) by @micheltlutz in #65
- Fix: política de URL cobre srcset, ping, srcdoc e data: em frames (S7) by @micheltlutz in #66
- Add: seo::json_ld e script_json, JSON seguro dentro de <script> (S8) by @micheltlutz in #67
- Fix: CI e release com SHAs fixados, permissões mínimas e gates (S11) by @micheltlutz in #68
- Docs: base de conhecimento registra o lote D de segurança (L25–L30) by @micheltlutz in #69
- Docs: CHANGELOG do 1.0, MIGRATION.md, GETTING_STARTED.md e skill molt-migrate (D2, D4) by @micheltlutz in #70
- Docs: AGENTS.md ampliado, SECURITY.md com OWASP, docs/upstream-findings.md (D3) by @micheltlutz in #71
- Docs: estabilidade do Render, aviso em Node::raw, ROADMAP.md (D4) by @micheltlutz in #72
- Fix: guias de doctest não rodam em wasm32; verify.sh roda o wasm-pack test by @micheltlutz in #73
- Docs: base de conhecimento registra a política de superar o Swift e L31-L32 by @micheltlutz in #74
- Docs: remove a seção Parity with Winged-Swift do README by @micheltlutz in #75
- Docs: remove as referências ao Winged-Swift (fase 1) e move o porte para docs/history by @micheltlutz in #81
- Fix: teste de orçamento de alocações não é mais instável (mínimo de nove medições) by @micheltlutz in #84
- Refactor: remove as referências ao Winged-Swift (fase 2) e o script de paridade by @micheltlutz in #85
- Test: testes de propriedade, pacote enxuto e job do docs.rs (auditoria pré-1.0) by @micheltlutz in #87
- Update: versão 1.0.0 by @micheltlutz in #89
- Release 1.0.0: develop em main by @micheltlutz in #90
New Contributors
- @micheltlutz made their first contribution in #43
Full Changelog: v0.1.0...v1.0.0