angular-marked

WebJar for angular-marked

License

License

MIT
Categories

Categories

Angular User Interface Web Frameworks
GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

angular-marked-mathjax
Last Version

Last Version

0.0.14
Release Date

Release Date

Type

Type

jar
Description

Description

angular-marked
WebJar for angular-marked
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/Casear/angular-marked

Download angular-marked-mathjax

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/angular-marked-mathjax/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>angular-marked-mathjax</artifactId>
    <version>0.0.14</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/angular-marked-mathjax/
implementation 'org.webjars.bower:angular-marked-mathjax:0.0.14'
// https://jarcasting.com/artifacts/org.webjars.bower/angular-marked-mathjax/
implementation ("org.webjars.bower:angular-marked-mathjax:0.0.14")
'org.webjars.bower:angular-marked-mathjax:jar:0.0.14'
<dependency org="org.webjars.bower" name="angular-marked-mathjax" rev="0.0.14">
  <artifact name="angular-marked-mathjax" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='angular-marked-mathjax', version='0.0.14')
)
libraryDependencies += "org.webjars.bower" % "angular-marked-mathjax" % "0.0.14"
[org.webjars.bower/angular-marked-mathjax "0.0.14"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.bower : angular jar [1.2.5,)
org.webjars.bower : marked-mathjax jar [0,)

Project Modules

There are no modules declared in this project.

angular-marked

AngularJS Markdown using marked.

Usage

  1. bower install angular-marked or bower install Hypercubed/angular-marked
  2. Include the marked.js script into your app. By default should be at bower_components/marked/lib/marked.js.
  3. Include the angular-marked.js into your app. By default should be at bower_components/angular-marked/angular-marked.js.
  4. Add hc.marked as a module dependency to your app.

Set default options (optional)

	app.config(['markedProvider', function(markedProvider) {
	  markedProvider.setOptions({gfm: true});
	}]);

Example using highlight.js Javascript syntax highlighter (must include highlight.js script).

	markedProvider.setOptions({
      gfm: true,
      tables: true,
      highlight: function (code) {
        return hljs.highlightAuto(code).value;
      }
    });

As a directive

	<marked>
	     #Markdown directive
	     *It works!*  
	</marked>

Bind the markdown input to a scope variable:

	<div marked="my_markdown">
	</div>
	<!-- Uses $scope.my_markdown -->

Include a markdown file:

	<div marked ng-include="'README.md'">
	</div>
	<!-- Uses markdown content from README.md -->

As a service

	app.controller('myCtrl', ['marked', function(marked) {
	  $scope.html = marked('#TEST');
	}]);

Testing

Install npm and bower dependencies:

	npm install
	bower install
	npm test

Why?

I wanted to use marked instead of showdown as used in angular-markdown-directive as well as expose the option to globally set defaults. Yes, it is probably best to avoid creating a bunch of angular wrapper modules... but I use this enough across multiple projects to make it worth while for me. Use it if you like. Pull requests are welcome.

Acknowledgments

Based on angular-markdown-directive by briantford which, in turn, is based on this excellent tutorial by @johnlinquist.

License

MIT

Versions

Version
0.0.14