diff --git a/examples/docs/abstract.schema.md b/examples/docs/abstract.schema.md index b58d18a7b5175383d78db54d1622c01a3e7e1973..c7cd2424ac94f7f32e6b9f8ecd749b5c19d31458 100644 --- a/examples/docs/abstract.schema.md +++ b/examples/docs/abstract.schema.md @@ -6,30 +6,4 @@ foo: bar --- - --- ---- -template : reference -foo : bar ---- - - -# Abstract - -* **Type:** object - -This is an abstract schema. It has `definitions`, but does not declare any properties - - - -## first -### Properties -### foo -* **Type:** string - - A unique identifier given to every addressable thing. -## second -### Properties -### bar -* **Type:** string - - A unique identifier given to every addressable thing. +--- \ No newline at end of file diff --git a/examples/docs/definitions.schema.md b/examples/docs/definitions.schema.md index 6fa18af9c6124bd89d293f520f9c341df90a9d78..c7cd2424ac94f7f32e6b9f8ecd749b5c19d31458 100644 --- a/examples/docs/definitions.schema.md +++ b/examples/docs/definitions.schema.md @@ -6,26 +6,4 @@ foo: bar --- - --- ---- -template : reference -foo : bar ---- - - -# Definitions - -* **Type:** object - -This is an example of using a `definitions` object within a schema. -It is imported using `allOf` and `$ref`. - -## Properties - -### id -* **Required** -* **Type:** string -* **Format:** uri - - A unique identifier given to every addressable thing. - +--- \ No newline at end of file diff --git a/examples/docs/example.schema.md b/examples/docs/example.schema.md index 0a04b72cc4f1d9ed553c054b2d3c1eabc2c67d3a..c7cd2424ac94f7f32e6b9f8ecd749b5c19d31458 100644 --- a/examples/docs/example.schema.md +++ b/examples/docs/example.schema.md @@ -6,36 +6,4 @@ foo: bar --- - --- ---- -template : reference -foo : bar ---- - - -# Example - -* **Type:** object - -This is an example schema with examples. Too many examples? There can never be too many examples! - -**Examples:** -```json -{ - "foo": "bar", - "bar": "baz" -} -``` - - -## Properties - -### foo -* **Type:** string - - A simple string. -### bar -* **Type:** string - - A simple string. - +--- \ No newline at end of file diff --git a/examples/docs/simple.schema.md b/examples/docs/simple.schema.md index a00a3648c1902f71cf76e7310a2006d4d4ff0ba9..c7cd2424ac94f7f32e6b9f8ecd749b5c19d31458 100644 --- a/examples/docs/simple.schema.md +++ b/examples/docs/simple.schema.md @@ -6,24 +6,4 @@ foo: bar --- - --- ---- -template : reference -foo : bar ---- - - -# Simple - -* **Type:** object - -This is a *very* simple example of a JSON schema. There is only one property. - -## Properties - -### id -* **Type:** string -* **Format:** uri - - A unique identifier given to every addressable thing. - +--- \ No newline at end of file diff --git a/examples/docs/subdir/subdir.schema.md b/examples/docs/subdir/subdir.schema.md index 53f96928a7abcafb13678eded93c805fb8a0e74f..c7cd2424ac94f7f32e6b9f8ecd749b5c19d31458 100644 --- a/examples/docs/subdir/subdir.schema.md +++ b/examples/docs/subdir/subdir.schema.md @@ -6,25 +6,4 @@ foo: bar --- - --- ---- -template : reference -foo : bar ---- - - -# Subdir - -* **Type:** object - -A schema in a sub directory - - - -## content -### Properties -### id -* **Type:** string -* **Format:** uri - - A unique identifier given to every addressable thing. +--- \ No newline at end of file diff --git a/lib/markdownWriter.js b/lib/markdownWriter.js index 4ae8ed99f09268d8a4998918f23d13b56e7d18be..54af0d8eef76c69c8730bf0d5704a4e25ace5d10 100644 --- a/lib/markdownWriter.js +++ b/lib/markdownWriter.js @@ -40,10 +40,13 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen console.log(schema.metaElements); + // this structure allows us to have separate templates for each element. Instead of having + // one huge template, each block can be built individually const multi = [ - [ 'header.ejs', { meta: schema.metaElements } ], - [ 'divider.ejs', null ], - [ 'topSchema.ejs', ctx ] + [ 'frontmatter.ejs', { meta: schema.metaElements } ], + //[ 'divider.ejs', null ], + //[ 'topSchema.ejs', ctx ], + [ 'divider.ejs', null ] ].map(([ template, context ]) => { return [ path.join(__dirname, '../templates/md/' + template), diff --git a/templates/md/divider.ejs b/templates/md/divider.ejs index 5f6729fd7d8a8b84e3af838739ef7aa1c845cd66..9d24bb8f18545e0a777bcd9448e531f13cf16044 100644 --- a/templates/md/divider.ejs +++ b/templates/md/divider.ejs @@ -4,4 +4,4 @@ * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 */ %> - --- \ No newline at end of file +--- \ No newline at end of file diff --git a/templates/md/header.ejs b/templates/md/frontmatter.ejs similarity index 100% rename from templates/md/header.ejs rename to templates/md/frontmatter.ejs