ember-marked
Ember component to easily render markdown (using marked
, so GFM and syntax highlighting supported from scratch).
A very basic example application using those components is available there.
Installation
npm install --save-dev ember-marked
Using
- To render markdown content, simply use the component in your templates:
{{markdown-section content=someMarkdownProperty}}
- You also have access to a
code-section
component used to render syntax highlighted code:{{code-section content=someSourceCode language='javascript'}}
- You can look at the example application under
tests/dummy
, especially theapp/templates/application.hbs
showing a very simple example of using this addon. - If you'd like to specify options to pass to marked, just set the "options" property when you use the component:
{{markdown-section content=markdownProperty options=myMarkdownOptions}}
Configuration
- You can configure which
marked
andhighlight.js
to use in your application configuration (config/environment.js
) by adding amarked
section like this:marked:// marked settings//version: '0.3.2', // default version, used when the js is not specified//js: false, // disable inclusion of the javascript (can be the URL to some other CDN)// highlight.js settingshighlightjs: // <== set to false to disable totally the inclusion of highlightjs//version: '8.3', // default version, used when the js and/or css are not specified//js: false, // disable inclusion of the javascript (can be the URL to some other CDN)//css: false, // disable inclusion of the css (can be the URL to some other CDN)
Credits
- Author: Huafu Gandon
- This is using marked and optionally highlightjs to render syntax highlighting sections