New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ng-showdown

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-showdown

Official Showdown integration with AngularJS

1.1.0
latest
Source
npm
Version published
Weekly downloads
1.5K
6.23%
Maintainers
2
Weekly downloads
 
Created
Source

ng-showdown

Angular integration for Showdown

How to use it

  • Install it

a. via bower:

bower install --save ng-showdown

b. via npm

npm install --save ng-showdown
  • Include 'ng-showdown' in your module dependencies
  • Use it
<p markdown-to-html="vm.mymarkdown"></p>

Dependencies

ng-showdown depends on the ngSanitize module. Don't forget to include it:

<script src="angular.js"></script>
<script src="angular-sanitize.js"></script>

API

$showdown

$showdown.makeHtml(markdown) - Converts a markdown text into HTML

Input: string - markdown to be parsed

Output: string - html output from showdown

$showdown.stripHtml - Strips a text of it's HTML tags. See http://stackoverflow.com/questions/17289448/angularjs-to-output-plain-text-instead-of-html

Input: string - html to be stripped

Output: string - string without <html> tags

markdownToHtml directive

Example usage:

 <p markdown-to-html="vm.mymarkdown"></p>

Input: string - markdown to be parsed

Output: string - html output from showdown

stripHtml filter

Example usage:

 <p ng-bind="vm.someText | stripHtml"></p>

Input: string - Input to be stripped of html

Output: string - stripped html

Configuration

You can configure the options and extensions passed to showdown by using the $showdownProvider. To see these options, visit the Showdown page.

$showdownProvider.setOption(key, value) - sets the passed in option as a configuration option in showdown

$showdownProvider.getOption(key) - get the option as determined by the passed in key.

$showdownProvider.loadExtension(extensionName) - loads the extension into showdown as determined by the passed in extension name

FAQs

Package last updated on 21 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts