Skip to content

Commit

Permalink
feat: support code_inline
Browse files Browse the repository at this point in the history
  • Loading branch information
wavesheep committed Oct 19, 2021
1 parent e7696e0 commit d731a00
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@
0.2.1
------------------

- Fix wrong type declaration.
- Fix wrong type declaration.

0.3.0
------------------

- Support `code_inline`

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ npm install markdown-it-plain-text
### browser (CDN)

### uncompressed
[https://cdn.jsdelivr.net/gh/wavesheep/[email protected]/dist/markdown-it-plain-text.js](https://cdn.jsdelivr.net/gh/wavesheep/[email protected]/dist/markdown-it-plain-text.js)
[https://cdn.jsdelivr.net/gh/wavesheep/[email protected]/dist/markdown-it-plain-text.js](https://cdn.jsdelivr.net/gh/wavesheep/[email protected]/dist/markdown-it-plain-text.js)

### compressed
[https://cdn.jsdelivr.net/gh/wavesheep/markdown-it-plain-text@0.2.1/dist/markdown-it-plain-text.min.js](https://cdn.jsdelivr.net/gh/wavesheep/markdown-it-plain-text@0.2.1/dist/markdown-it-plain-text.js)
[https://cdn.jsdelivr.net/gh/wavesheep/markdown-it-plain-text@0.3.0/dist/markdown-it-plain-text.min.js](https://cdn.jsdelivr.net/gh/wavesheep/markdown-it-plain-text@0.3.0/dist/markdown-it-plain-text.js)

## Usage examples

Expand Down Expand Up @@ -60,7 +61,7 @@ md.plainText
```
## Generation rule

1. extract `text`, `fence`, `html_block`, `code_block`, `html_inline`, `emoji` content directly
1. extract `text`, `fence`, `html_block`, `code_block`,`code_inline`, `html_inline`, `emoji` content directly
2. add `space` at closing tag to *prevent words from sticking together*
3. *remove redundant white spaces* from result

Expand Down
3 changes: 2 additions & 1 deletion dist/markdown-it-plain-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var markdownItPlainTextPlugin = (function () {
token.type === 'fence' ||
token.type === 'html_block' ||
token.type === 'code_block' ||
token.type === 'code_inline' ||
token.type === 'html_inline' ||
token.type === 'emoji'
) {
Expand All @@ -38,4 +39,4 @@ var markdownItPlainTextPlugin = (function () {

return markdownItPlainText;

}());
})();
2 changes: 1 addition & 1 deletion dist/markdown-it-plain-text.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = function plainTextPlugin(md) {
token.type === 'fence' ||
token.type === 'html_block' ||
token.type === 'code_block' ||
token.type === 'code_inline' ||
token.type === 'html_inline' ||
token.type === 'emoji'
) {
Expand Down
2 changes: 1 addition & 1 deletion test/data/default-result
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Advertisement :) pica - high quality and fast imageresize in browser. babelfish - developer friendlyi18n with plurals support and easy syntax. You will like those projects! h1 Heading 8-) h2 Heading h3 Heading h4 Heading h5 Heading h6 Heading Horizontal Rules Typographic replacements Enable typographer option to see result. (c) (C) (r) (R) (tm) (TM) (p) (P) +- test.. test... test..... test?..... test!.... !!!!!! ???? ,, -- --- "Smartypants, double quotes" and 'single quotes' Emphasis This is bold text This is bold text This is italic text This is italic text Strikethrough Blockquotes Blockquotes can also be nested... ...by using additional greater-than signs right next to each other... ...or with spaces between arrows. Lists Unordered Create a list by starting a line with , , or Sub-lists are made by indenting 2 spaces: Marker character change forces new list start: Ac tristique libero volutpat at Facilisis in pretium nisl aliquet Nulla volutpat aliquam velit Very easy! Ordered Lorem ipsum dolor sit amet Consectetur adipiscing elit Integer molestie lorem at massa You can use sequential numbers... ...or keep all the numbers as Start numbering with offset: foo bar Code Inline Indented code // Some comments line 1 of code line 2 of code line 3 of code Block code "fences" Sample text here... Syntax highlighting var foo = function (bar) { return bar++; }; console.log(foo(5)); Tables Option Description data path to data files to supply the data that will be passed into templates. engine engine to be used for processing templates. Handlebars is the default. ext extension to be used for dest files. Right aligned columns Option Description data path to data files to supply the data that will be passed into templates. engine engine to be used for processing templates. Handlebars is the default. ext extension to be used for dest files. Links link text link with title Autoconverted link https://github.com/nodeca/pica (enable linkify to see) Images MinionStormtroopocat Like links, Images also have a footnote style syntax Alt text With a reference later in the document defining the URL location:
Advertisement :) pica - high quality and fast imageresize in browser. babelfish - developer friendlyi18n with plurals support and easy syntax. You will like those projects! h1 Heading 8-) h2 Heading h3 Heading h4 Heading h5 Heading h6 Heading Horizontal Rules Typographic replacements Enable typographer option to see result. (c) (C) (r) (R) (tm) (TM) (p) (P) +- test.. test... test..... test?..... test!.... !!!!!! ???? ,, -- --- "Smartypants, double quotes" and 'single quotes' Emphasis This is bold text This is bold text This is italic text This is italic text Strikethrough Blockquotes Blockquotes can also be nested... ...by using additional greater-than signs right next to each other... ...or with spaces between arrows. Lists Unordered Create a list by starting a line with +, -, or * Sub-lists are made by indenting 2 spaces: Marker character change forces new list start: Ac tristique libero volutpat at Facilisis in pretium nisl aliquet Nulla volutpat aliquam velit Very easy! Ordered Lorem ipsum dolor sit amet Consectetur adipiscing elit Integer molestie lorem at massa You can use sequential numbers... ...or keep all the numbers as 1. Start numbering with offset: foo bar Code Inline code Indented code // Some comments line 1 of code line 2 of code line 3 of code Block code "fences" Sample text here... Syntax highlighting var foo = function (bar) { return bar++; }; console.log(foo(5)); Tables Option Description data path to data files to supply the data that will be passed into templates. engine engine to be used for processing templates. Handlebars is the default. ext extension to be used for dest files. Right aligned columns Option Description data path to data files to supply the data that will be passed into templates. engine engine to be used for processing templates. Handlebars is the default. ext extension to be used for dest files. Links link text link with title Autoconverted link https://github.com/nodeca/pica (enable linkify to see) Images MinionStormtroopocat Like links, Images also have a footnote style syntax Alt text With a reference later in the document defining the URL location:

0 comments on commit d731a00

Please sign in to comment.