readout-markdown v0.0.1
readout
A tool for inserting markdown content into your site as HTML.
This project is early in its development. The premise is that when it comes to writing actual content, you probably don't need anything besides markdown. As a huge fan of it, I'd like to be able to write all of my "word-stuff" in good ol' markdown, but insert it nicely into a page.
To see an example: this README itself is rendered on the readout site
Installation
Install readout via npm or markdown.
bower install readout-markdown
or
npm install readout-markdown
How to use
Put dependencies into your html or template
<script type="text/javascript" src="/bower_components/jquery/dist/jquery.min.js"></script> <script type="text/javascript" src="/bower_components/readout/dist/readout.js"></script>
Add the data-readout-src attribute where you want your markdown inserted into in your HTML, with the value being the path to the markdown file, as shown below.
<article data-readout-src="/content/hello.md"></article>
You can also nest your markdown, to match your file-system's hierarchy. For example:
# Directory of resources content/ ├── example.md └── hello.md
<div data-readout-src="content"> <div data-readout-src="example.md"></div> <div data-readout-src="hello.md"></div> </div>
Call readout!
<script type="text/javascript"> $(function() { Readout(); }); </script>
Options
The constructor accepts the following options:
namespace
: You can specify your own custom namespace, instead ofdata-readout-src
, but it must follow the string patterndata-\*
calllback: function(el, html)
: You can add a callback that acceptsel
andhtml
as parameters. By default el just gets assigned the resulting html.
8 years ago