Skip to content

API overview ​

SevenMark separates syntax parsing, document transformation, HTML rendering, and editor tooling. The host application owns persistence and authorization.

Crates ​

CratePurposeTarget
sevenmark_astAST types, document references, and traversalNative/WASM
sevenmark_specShared syntax and parameter specificationsNative/WASM
sevenmark_parserSource text to SyntaxDocumentNative/WASM
sevenmark_formatterSevenMark source formattingNative/WASM
sevenmark_htmlProcessed AST to sanitized HTML and scoped CSSNative
sevenmark_utilsShared text and position utilitiesNative/WASM
sevenmark_wasmWASM parser bindingsWASM
sevenmark_wasm_lspWASM LSP bindingsWASM
sevenmark_wasm_formatterWASM formatter bindingsWASM
sevenmark_transformSemantic processing and approved reference resolutionNative
sevenmark_lsp_coreLSP methods without a transport or network clientNative/WASM
sevenmark_language_serverNative LSP stdio transportNative
sevenmark_serverApproved-input HTTP APINative

Document processing ​

  1. sevenmark_parser parses source into a SyntaxDocument.
  2. sevenmark_transform evaluates local variables and conditionals, then expands approved includes.
  3. sevenmark_transform applies approved reference decisions to produce a RenderDocument.
  4. sevenmark_html renders the processed AST as sanitized HTML and scoped CSS.
  5. sevenmark_server returns the HTML and document metadata in its HTTP response.

The host supplies approved source revisions and current reference decisions. The renderer does not acquire database, storage, session, or policy authority. Before delivery, the host rechecks access to the root and each used dependency.

Parser and AST ​

sevenmark_parser::parse_document(&str) returns a SyntaxDocument. It retains the original source byte length and the parsed Element nodes. The AST crate provides element types, visitors, and the shared DocumentReference enum.

Enable include_locations to serialize source positions. Native AST spans use UTF-8 byte offsets. sevenmark_utils::convert_ast_to_utf16_offset_json() converts those spans to absolute UTF-16 code unit offsets for editors.

See Parser API, AST structure, and document reference syntax.

WASM bindings ​

The parser wrapper exposes two functions:

  • parse_sevenmark(input) returns AST JSON with UTF-8 byte offsets.
  • parse_sevenmark_to_codemirror(input) returns AST JSON with UTF-16 offsets.

The LSP wrapper exposes handle_lsp_message(json). It processes JSON-RPC messages and returns responses and notifications. Native and WASM transports use sevenmark_lsp_core for diagnostics, semantic tokens, completion, hover, and other language features.

For document references, the host supplies authorized candidates. The LSP formats exact-range UUID edits and returns parsed reference ranges. It does not fetch candidates or resolve access. See the document reference LSP contract.

Transform boundary ​

sevenmark_transform separates syntax from request-local semantic processing. Its result types mark each stage: SyntaxDocument, SemanticDocument, and RenderDocument with a RenderAst.

The transform requests approved data through the WikiResolver port. Its production dependencies do not include a database driver, object-storage SDK, HTTP/OpenAPI types, or the parser. The caller supplies parsed source and a resolver implementation.

HTTP service ​

sevenmark_server exposes these routes:

RoutePurpose
POST /v1/analyzeAnalyze references, mentions, external links and a link preview in host source
POST /v1/analyze-bundleAnalyze references after approved include expansion
POST /v1/renderRender an approved source bundle
GET /health/liveCheck whether the service is running
GET /health/readyCheck whether the service accepts work

The HTTP routes use /v1. Payloads use contract_version: 8. The service bounds source bytes, include expansion, response bytes, CPU concurrency, and elapsed request time. See the renderer wire contract.

Browser runtime ​

The independent browser runtime hydrates sanitized renderer output. The host supplies routing, locale, theme, and authorized data adapters.