kcode-k1-web-code-document 0.2.0

Represent one versionless authored K1 Web code document
Documentation
1
2
3
4
5
6
7
# Versionless authored Web document

`CodeDocument::new(family, documentation, language, code)` owns exact authored `Documentation.md` and UTF-8 `Code.js`, `Code.html`, or `Code.css` bytes without assigning a release version. `to_source_package(version)` generates the canonical public/check projection and injects that stable SemVer only into `k1-web.json`; `from_source_package` strips an exact canonical projection back to the same authored representation.

The documentation starts with exact LF-delimited `<!-- k1-web/v1`, canonical compact `{"dependencies":[...]}`, and `-->` lines. Dependencies are validated by the Web package contract. Authored bytes, including BOMs, CRLF and final-newline state, are never normalized. JavaScript exports `runTests`; fixed HTML and CSS adapters retain their prior behavior.

`chunk_ranges` returns continuous ranges that concatenate to the exact code. It prefers complete JavaScript statements/class members, CSS rules, and HTML nodes around 800 Unicode scalars, merges short tails backward, and returns one complete range for unsupported or unbalanced input. Empty code returns `0..0`. Work is unbenchmarked and linear apart from scalar-count packing over preferred boundaries.