-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes GH-21. Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com> Reviewed-by: Titus Wormer <tituswormer@gmail.com>
- Loading branch information
1 parent
d714e93
commit ba3a801
Showing
5 changed files
with
82 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// TypeScript Version: 3.0 | ||
|
||
import {Plugin} from 'unified' | ||
|
||
declare namespace strip { | ||
interface Options { | ||
/** | ||
* List of node types to leave unchanged. | ||
*/ | ||
keep?: Array< | ||
| 'heading' | ||
| 'text' | ||
| 'inlineCode' | ||
| 'image' | ||
| 'imageReference' | ||
| 'break' | ||
| 'blockquote' | ||
| 'list' | ||
| 'listItem' | ||
| 'strong' | ||
| 'emphasis' | ||
| 'delete' | ||
| 'link' | ||
| 'linkReference' | ||
| 'code' | ||
| 'horizontalRule' | ||
| 'thematicBreak' | ||
| 'html' | ||
| 'table' | ||
| 'tableCell' | ||
| 'definition' | ||
| 'yaml' | ||
| 'toml' | ||
> | ||
} | ||
} | ||
|
||
/** | ||
* Remark plugin to remove Markdown formatting. | ||
* | ||
* Removes `html`, `code`, `horizontalRule`, `table`, `yaml`, `toml` nodes and their content, | ||
* everything else is rendered as simple paragraphs without formatting. | ||
* Uses `alt` text for images. | ||
*/ | ||
declare const strip: Plugin<[strip.Options?]> | ||
|
||
export = strip |
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,8 @@ | ||
import remark = require('remark') | ||
import strip = require('strip-markdown') | ||
|
||
remark().use(strip) | ||
remark().use(strip, {keep: []}) | ||
remark().use(strip, {keep: [`table`]}) | ||
|
||
remark().use(strip, {keep: [`typo`]}) // $ExpectError |
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,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"lib": ["es2015"], | ||
"strict": true, | ||
"noEmit": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"strip-markdown": ["."] | ||
} | ||
} | ||
} |
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,7 @@ | ||
{ | ||
"extends": "dtslint/dtslint.json", | ||
"rules": { | ||
"semicolon": false, | ||
"whitespace": false | ||
} | ||
} |