Display Markdown content in angular-schema-form with chjj/marked
This Marked add-on uses as the name implies the Marked plugin to provide a field to display Markdown content in schema form. Marked as well as angular-marked is used.
Marked is full-featured markdown parser and compiler. it is highly customizable and this add-on takes an options object via markedOptions
in the form. More info below at Options.
The editor is an add-on to the Bootstrap decorator. To use it, just include
bootstrap-marked.min.js
after dist/bootstrap-decorator.min.js
.
Easiest way is to install is with bower, this will also include dependencies:
$ bower install angular-schema-form-marked
You'll need to load a few additional files to use the editor:
Be sure to load this projects files after you load angular schema form
- Angular
- The Marked source file
- The angular-marked source file
- Angular Schema Form
- The Angular Schema Form Marked files (this project)
Example
<script type="text/javascript" src="/bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="/bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script type="text/javascript" src="bower_components/marked/lib/marked.js"></script>
<script type="text/javascript" src="/bower_components/angular-marked/angular-marked.js"></script>
<script type="text/javascript" src="/bower_components/angular-schema-form/schema-form.min.js"></script>
<script type="text/javascript" src="/bower_components/angular-schema-form-marked/bootstrap-marked.js"></script>
When you create your module, be sure to depend on this project's module as well.
angular.module('yourModule', ['schemaForm', 'schemaForm-marked']);
The marked add-on adds a new form type, marked
, and a new default
mapping.
Form Type | Becomes |
---|---|
marked | a marked widget |
Schema | Default Form type |
---|---|
"type": "string" | marked |
angular-marked has default option that can be configured in the module. Currently, the only option is {gfm: true}