Skip to content

Commit

Permalink
fix(index): example for parser/render
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Oct 10, 2019
1 parent aa55451 commit d25743f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ function PostHTML (plugins) {
* export default function plugin (options = {}) {
* return function (tree) {
* tree.match({ tag: 'include' }, function(node) {
* node.content = tree.parser(fs.readFileSync(node.attr.src))
* var content = tree.parser(fs.readFileSync(node.attr.src))
* node.content = content.match({ tag: 'import' }, function(node) {
* node.content = tree.parser(fs.readFileSync(node.attr.src))
* return node
* })
* return node
* })
*
* return tree
Expand All @@ -79,15 +84,11 @@ function PostHTML (plugins) {
* @example
* ```js
* export default function plugin (options = {}) {
* return function (tree) {
* function (tree) {
* var outherTree = ['\n', {tag: 'div', content: ['1']}, '\n\t', {tag: 'div', content: ['2']}, '\n'];
* var htmlWitchoutSpaceless = tree.render(outherTree).replace(/[\n|\t]/g, '');
* return tree.parser(htmlWitchoutSpaceless)
* }
*
* return tree
* }
* return function (tree) {
* var outherTree = ['\n', {tag: 'div', content: ['1']}, '\n\t', {tag: 'div', content: ['2']}, '\n'];
* var htmlWitchoutSpaceless = tree.render(outherTree).replace(/[\n|\t]/g, '');
* return tree.parser(htmlWitchoutSpaceless)
* }
* }
* ```
*/
Expand Down

0 comments on commit d25743f

Please sign in to comment.