feat: DOT-LD import and markdown export#13
Merged
Conversation
- packages/core/src/io/dot-ld.js: parse ::config blocks (type defs + entity assignments), ::rel blocks (→, ←, ↔), [[EntityName]] refs; export to DOT-LD markdown; importer/exporter descriptors - packages/web/public/io/exporters/dot-ld-html.js: standalone LODE-style HTML page with sidebar TOC, entity-types section, per-entity detail (properties + in/out relationships), relationships table, ontology metadata from owl:Ontology node or graph title/description - packages/core/src/index.js: export importFromDotLD, exportToDotLD, dotLdImporter, dotLdExporter - packages/web/public/app.js: register dotld importer and dotld / dotld-html exporters - packages/core/tests/dot-ld-io.test.js: 36 tests covering import, export, bidirectional edges, backward arrows, multi-config blocks, entity properties, undefined entities, and round-trip fidelity Agent-Logs-Url: https://github.com/jpmccu/boxes/sessions/cd481b95-9eea-429a-82cc-5c359ff556ac Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>
- Replace CONFIG_BLOCK_RE lazy [\s\S]*? with string-based block extraction to eliminate polynomial backtracking on malformed config blocks - Anchor REL_RE to single lines (^...$, m flag) and use [^\]\n]* instead of [^\]]* to prevent cross-line backtracking - Tighten darkenColor hex validation from < 7 to !== 7 Agent-Logs-Url: https://github.com/jpmccu/boxes/sessions/cd481b95-9eea-429a-82cc-5c359ff556ac Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>
- Cap PROP_PAIR_RE quoted string lengths at 500 chars
- Cap REL_RE label length at 200 chars
- Replace remaining [\s\S]*? config-stripping regexes with string-based
stripConfigBlocks() helper in parseEntityRefs and extractDescription
- Use toISOString().split('T')[0] for date formatting in HTML exporter
- Derive section numbers from tocItems array instead of ad-hoc arithmetic
Agent-Logs-Url: https://github.com/jpmccu/boxes/sessions/cd481b95-9eea-429a-82cc-5c359ff556ac
Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>
The DOT-LD exporter now produces only pure DOT-LD markdown. Deleted dot-ld-html.js and removed its import/registration from app.js. Agent-Logs-Url: https://github.com/jpmccu/boxes/sessions/cd481b95-9eea-429a-82cc-5c359ff556ac Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>
jpmccu
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds import and export support for DOT-LD — a markdown extension for embedding formal knowledge graph structures in technical documentation.
Core library (
packages/core/src/io/dot-ld.js)importFromDotLD): parses::configblocks (type definitions + entity assignments),::relblocks (->,<-,<->), and[[EntityName]]prose references into Boxes graph format. Bidirectional<->edges round-trip as a pair of directed edges sharing a_dotldBiditoken. Undefined entities (referenced but not assigned a type) are created automatically.exportToDotLD): converts palette node types → type definitions, nodes → entity assignments, edges →::relblocks. Bidi pairs collapse back to<->.dotLdImporter/dotLdExporterdescriptors following the existing I/O plugin contract.Example DOT-LD document that round-trips cleanly:
ReDoS hardening
Config block bodies are extracted with
String.indexOfrather than a greedy[\s\S]*?regex. The::relpattern is anchored to single lines (^…$withmflag) and label/quoted-value capture groups are length-capped ({0,200}/{0,500}).Registration (
packages/web/public/app.js)dotldimporter anddotldmarkdown exporter added to the existing I/O registry.