Skip to content

Repository files navigation

@onetimelabs/otml 2.0.3

OTML 2.0.3 is the semantic-renderer patch for OTML 2.0.

What 2.0.1 fixes

Every currently declared OTML 2.0 semantic block now has an intentional React renderer:

  • {section}
  • {subsection}
  • {title} (legacy)
  • {subtitle} (legacy)
  • {text} (legacy)
  • {label}
  • {info}
  • {note}
  • {warning}
  • {critical}
  • {requirement}
  • {highlight}
  • {decision}
  • {expected}
  • {input}
  • {output}
  • {definition}
  • {code}
  • {command}
  • {path}
  • {schema}
  • {quote}
  • {example}
  • {list}
  • {steps}
  • {checklist}
  • {prerequisites}
  • {reference}
  • {references}

Normal prose is also valid inside OTML 2.0 sections.

References

OTML renders references and exposes them in parseOTML(content).references.

The host application owns reference resolution. For OTLES:

<OTMLRenderer
  content={content}
  onReferenceClick={(reference) => {
    // Resolve DEV-003, DEP-002, etc. inside OTLES.
  }}
/>

Outline

parseOTML(content).outline uses:

  1. OTML 2.0 {section} / {subsection} headings when present.
  2. Legacy {title} blocks when there are no semantic sections.
  3. Legacy {subtitle} blocks when there are neither sections nor titles.

Publishing

npm install
npm run build
npm pack --dry-run
npm publish --access public

Then in OTLES:

npm install @onetimelabs/otml@2.0.1

2.0.3 nested semantic parser fix

2.0.3 replaces section parsing with a true recursive parser.

This specifically fixes semantic blocks such as {decision}, {definition}, {reference}, {critical}, {expected}, {command}, {checklist}, and other OTML nodes disappearing when placed inside {section} or {subsection}.

Use OTML_2.0.3_NESTED_TEST.txt to verify the exact regression.

2.0.3 section-container parser fix

2.0.3 changes OTML parsing from line-oriented section parsing to a recursive token-stream parser.

{section} and {subsection} are now true semantic containers. Recognized OTML tags inside those containers are parsed as child nodes and passed to the normal renderer. This includes {input}, {output}, {decision}, {definition}, {reference}, {critical}, {expected}, {command}, lists, and other supported OTML blocks.

The parser also recognizes leaf tags when the opening/content/closing tags are on the same line.

Use OTML_2.0.3_SECTION_REGRESSION_TEST.txt after installing the package in OTLES.

OTML 2.0.3 inline markup

2.0.3 now supports true inline OTML inside prose and value blocks.

Supported inline tags:

  • {bold}...{/bold}
  • {italic}...{/italic}
  • {code}...{/code}
  • {command}...{/command}
  • {path}...{/path}
  • {reference}...{/reference}
  • {label}...{/label}
  • {key}...{/key}
  • {value}...{/value}

Example:

{text}
Run {command}npm run build{/command} from {path}C:\Projects\OTML{/path}
and review {reference}DEV-003{/reference}.
{/text}

Block-level forms remain supported for backwards compatibility.

2.0.4 runtime verification

This release is built from the current OTML source supplied for debugging.

After building:

npm run build
npm run verify:runtime

Expected output begins with:

PASS: @onetimelabs/otml runtime 2.0.4

The renderer root also contains:

data-otml-version="2.0.4"

and the package exports:

import { OTML_VERSION } from "@onetimelabs/otml";

This makes it possible to verify that OTLES is actually executing the newly installed package instead of a stale Vite/npm artifact.

Parser-only verification entry

The package now builds a parser-only module at:

dist/parser.js

This module does not import the React renderer or CSS. Therefore:

npm run build
npm run verify:runtime

can verify recursive {section} parsing directly in Node.

The package also exposes:

import { parseOTML } from "@onetimelabs/otml/parser";