schema-markdown-doc
v1.6.3
Published
Schema Markdown documentation library
Downloads
59
Readme
schema-markdown-doc
The schema-markdown-doc package generates documentation for Schema Markdown schemas.
Links
The Schema Markdown Documentation Component
The schemaMarkdownDoc function generates the element model for a Schema Markdown user type's documentation. For example:
import {parseSchemaMarkdown} from 'schema-markdown/lib/parser.js';
import {schemaMarkdownDoc} from 'schema-markdown-doc/lib/schemaMarkdownDoc.js';
const types = parseSchemaMarkdown(`\
# My struct
struct MyStruct
# My member
string member
`);
const elements = schemaMarkdownDoc(types, 'MyStruct');
The element model is rendered using element-model's renderElements function.
import {renderElements} from 'element-model/lib/elementModel.js';
renderElements(window.document.body, elements);
The Schema Markdown Documentation Viewer
To host your Schema Markdown type model's documentation, first, download the schema-markdown-doc application stub to the directory containing your type model's JSON:
curl -O https://craigahobbs.github.io/schema-markdown-doc/extra/index.html
By default, the schema-markdown-doc application stub displays documentation for "model.json". You can override the resource URL and specify a schema title by updating the schema-markdown-doc application stub, "index.html". For example:
~~~ markdown-script
include 'https://craigahobbs.github.io/schema-markdown-doc/doc/app.mds'
schemaMarkdownDoc('myModel.json', 'My Model')
~~~
To host locally, start a local static web server:
python3 -m http.server
You can also override the resource URL by adding the "var.vURL" hash parameter (i.e., "#var.vURL='myModel.json'").
Development
This package is developed using javascript-build. It was started using javascript-template as follows:
template-specialize javascript-template/template/ schema-markdown-doc/ -k package schema-markdown-doc -k name 'Craig A. Hobbs' -k email '[email protected]' -k github 'craigahobbs' -k noapp 1