The project is in a healthy, maintained state
A typed node tree (blocks, inlines, marks) projected from Metanorma document models, with serializers and an output pipeline. metanorma-document and metanorma-standoc register their model classes; the format is the wire contract for renderers and tooling (the SMART document reader, the HTML JS renderer).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

 Project Readme

metanorma-mirror

The Mirror format: a lossless JSON projection of a Metanorma document as a typed node tree — blocks, inline runs, marks — preserving document order, attributes, and provenance. It is the wire contract consumed by the SMART document reader and the HTML JS renderer, and it provides the mirror provenance object embedded in MKO bundles.

What lives here

  • Node models (Metanorma::Mirror::Model) — lutaml-model Serializables with key_value mappings; the JSON wire is the contract.

  • The transformer walk, handler registry, and rewriter.

  • Serializers (JSON, YAML) and the output pipeline.

What does NOT live here

Model knowledge. Which document classes map to which handlers, mark types, rich-HTML renderers, and id categories is registered by the model gems: metanorma-document and metanorma-standoc seed the defaults through the registration seams (Mirror.register_default, Mirror.mark_builders, Mirror.rich_html_renderers, Mirror.simple_inline_elements, Mirror.inline_text_substitutions, Mirror.semx_elements, Mirror.inline_content_iterator, Mirror::IdStrategy::Positional.register_category). A new flavor or model registers; this gem never changes (OCP).

Usage

require "metanorma/mirror"
require "metanorma/document"   # seeds the default registrations

tree = Metanorma::Mirror::Transformer.new.call(model)
json = Metanorma::Mirror::Serialization::JsonSerializer.serialize(tree)

License

BSD-2-Clause.