3.6.1 • Published 7 years ago

ember-remarkable v3.6.1

Weekly downloads
40
License
MIT
Repository
github
Last release
7 years ago

ember-remarkable Build Status Ember Observer Score

Add Remarkable markdown parsing helpers and components to your Ember app.

Installation

ember install ember-remarkable

Usage

{{md-text
  text        = "# Markdown text!"
  typographer = true
  linkify     = false
}}

Options

optiontypedefaultsecuritydescription
textstringMarkdown content to render
typographerbooleanfalseWhether to enable Remarkable's typographer option
linkifybooleanfalseWhether to enable Remarkable's linkify option
htmlbooleanfalse:warning: insecureWhether to enable Remarkable's html option
extensionsbooleantrueWhether to enable Remarkable's syntax extensions
dynamicbooleanfalse:warning: insecureWhether to enable dynamic template rendering (see below)

Inline multi-line input

When you provide the text inline, you can split it into multiple lines like this:

<div>
  {{md-text
    text = "
# Hello world

Note that you have to unindent
the multiline `text` content.
    "
  }}
</div>

Dynamic Template Rendering

By enabling the dynamic option you can embed Ember components into your markdown:

{{md-text
  text = "{{link-to 'Foo' 'foo'}}"
}}

This feature is useful for implementing CMS-like functionality with Ember: it lets your Markdown content to be dynamic and Ember-driven rather than just static HTML.

But this approach is not encouraged by the Ember core team and might be deprecated in the future (though there are no plans to deprecate it as of May 2016).

:warning: Security implications

By using the html and dynamic template options you can make your app vulnerable to XSS.

Use those options only if your Markdown content is provided by trusted team members and regular users have no way to update it.

Syntax Highlighting

This addon uses highlight.js for syntax highlighting, in order to include it you just need to use Github style code-fencing. Currently, only the component supports syntax highlighting.

Excluding Highlightjs

The use of highlight.js can be disabled by adding the following option to your config/environment.js:

remarkable: {
  excludeHighlightJs: true
}

Setting to true will ensure that highlight.js won't be included in your build.

Custom Highlighting

The highlight function, as used by remarkable, can be overriden. To do this, create your own md-text component:

import MDTextComponent from 'ember-remarkable/components/md-text';

export default MDTextComponent.extend({ 
  highlight: function(str, lang) {
     return '';
  }
}); 

Plugins

You can pass plugins to each component instance by providing an array of plugin functions in a plugin option.

Development

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

Thanks to the following

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted with <3 by John Otander(@4lpine).

3.6.1

7 years ago

3.6.0

7 years ago

3.5.0

7 years ago

3.4.0

7 years ago

3.3.0

7 years ago

3.2.0

8 years ago

3.1.2

8 years ago

3.1.1

8 years ago

3.1.0

8 years ago

3.0.0

8 years ago

2.1.0

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.3.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago