Skip to content

Custom template override #123

@BrianWendt

Description

@BrianWendt

I think it would be a good idea to be able to override templates.

I propose adding an option
-t --template path to directory containing Embedded JavaScript (ejs) templates
jsonschema2md -o docs/reference -t docs/templates

The module would look first for the template ejs file in the given directory and fallback to the default template found in @adobe\jsonschema2md\templates\md.

This would provide the ability to override specific template includes giving users more control over their documentation.

I believe this would require some changes to the following

  • lib/markdownWriter.js
  • lib/readmeWriter.js
  • lib/schema.js (edit: I missed this in my initial evaluation)
  • templates/md/array-types.ejs
  • templates/md/property.ejs
  • templates/md/pattern-property.ejs
  • templates/md/object-type.ejs
  • templates/md/nested-property.ejs
  • templates/md/join-type.ejs
  • templates/md/innerSchema.ejs

The two lib files would be strait forward modifications. For the ejs files Wrapping the include() function to handle the search might be a good approach, imo.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions