-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from showdownjs/develop
ng-showdown 1.0.0
- Loading branch information
Showing
9 changed files
with
279 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,70 @@ | ||
ng-showdown | ||
================ | ||
# ng-showdown | ||
|
||
Angular integration for [Showdown](https://github.com/showdownjs/showdown) | ||
|
||
## How to use it | ||
|
||
1. Install it | ||
|
||
a. via bower: | ||
``` | ||
bower install --save ng-showdown | ||
``` | ||
b. via npm | ||
``` | ||
npm install --save ng-showdown | ||
``` | ||
2. Include `'ng-showdown'` in your module dependencies | ||
3. Use it | ||
``` | ||
<p markdown-to-html="vm.mymarkdown"></p> | ||
``` | ||
|
||
## 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 striped | ||
|
||
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 useing the `$showdownProvider`. To see these options, visit the [Showdown page](https://github.com/showdownjs/showdown). | ||
|
||
`$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 | ||
|
||
Angular integration for Showdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
module.exports = function (config) { | ||
'use strict'; | ||
config.set({ | ||
|
||
basePath: '', | ||
|
||
frameworks: ['mocha', 'chai'], | ||
|
||
files: [ | ||
'bower_components/angular/angular.js', | ||
'bower_components/angular-mocks/angular-mocks.js', | ||
'bower_components/angular-sanitize/angular-sanitize.js', | ||
'bower_components/showdown/dist/showdown.js', | ||
'src/*.js', | ||
'test/**/*.spec.js' | ||
], | ||
|
||
reporters: ['coverage'], | ||
|
||
preprocessors: { | ||
'src/**/*.js' : ['progress', 'coverage'] | ||
}, | ||
|
||
//plugins: [ | ||
// 'karma-chai', | ||
// 'karma-coverage', | ||
// 'karma-mocha', | ||
// 'karma-phantomjs-launcher' | ||
//], | ||
|
||
coverageReporter: { | ||
type: 'html', | ||
dir: 'coverage' | ||
}, | ||
|
||
port: 9876, | ||
colors: true, | ||
autoWatch: false, | ||
singleRun: true, | ||
|
||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
|
||
browsers: ['PhantomJS'] | ||
|
||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.