MarkdownRecord Docs

Content DSL

This section describes the Content DSL MarkdownRecord provides to allow you to define application data right alongside your written markdown content.

While writing documentation in your markdown source files, you can define json data using HTML comments which will then be made available to you within your application code (if you define matching models), or directly served via built in routes.

To do this, simply write an HTML comment like this in your markdown files:

<!--model 
  { 
    "type": "dsl_command",
    "id": 1, 
    "name": "model",
    "example_id": 1
  } 
-->

Note: you can write these JSON object inline as well to be more concise.

As you can see, all that is required is a JSON object inside a special comment that defines your data. The model part of the comment is a DSL command that tells MarkdownRecord how to process the comment, and in this case it will take your JSON object and include it in its final rendered JSON output, which will automatically make it available via the provided routes and controllers. If this part is missing or unrecognized, then the comment will be treated as a plain HTML comment and nothing will be done with its contents.

There are several different DSL commands that you can use to define application data within your markdown source documents. They are as follows:

You can view this document's source files in markdown_record/content to see some of the above DSL commands in use.

The above content was rendered from source files at: content/v_0_1/content_dsl