This section discusses the automatically available routes you can use to render markdown content as HTML or JSON.
If you are reading this document in a browser by rendering it from your application, then you will have already ran the Thor command necessary to render the demo content as HTML and JSON. You can also see the HTML and JSON files in the rendered
directory. In fact, the content you are viewing right now as you read this is one of those files, served to you via the built in routes that come with MarkdownRecord.
All of the following routes should now resolve successfully:
<application root path>/mdr/html/<content_path>
<application root path>/mdr/json/<content_path>
<application root path>/<content_path>
content_path
in the above routes is the path to a rendered file or directory (relative to the rendered
folder). When you navigate to a path that points to a directory, you will see the concatenated contents of everything that is in that directory.
The html
routes only return HTML, while the json
routes only return JSON. The generic route returns either HTML or JSON depending on the ACCEPT header of your request or the extension of the url you are accessing (for example, appending .json
at the end of the current url will load all the JSON models defined in this this document's markdown source files using the Content DSL commands described above).
In addition to the above routes, routes for downloading content are provided as well. They are:
<application root path>/mdr/html/download/<content_path>
<application root path>/mdr/json/download/<content_path>
<application root path>/download/<content_path>
The download routes are not enabled by default, but can be enabled if you want to be able to download your rendered content.
Here is a complete list of links to all the rendered HTML files of this demo (each item has a JSON and an HTML version), all of which use the routes described above:
Some of the above routes are the rendered versions of individual files, and some are the concatenated and rendered contents of an entire directory.
The above content was rendered from source files at: content/v_0_1/routes