You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Vse Mozhet Byt b4fea2a3d6 doc: add eslint-plugin-markdown 8 years ago
..
LICENSE doc: add eslint-plugin-markdown 8 years ago
history.md doc: add eslint-plugin-markdown 8 years ago
index.js doc: add eslint-plugin-markdown 8 years ago
package.json doc: add eslint-plugin-markdown 8 years ago
readme.md doc: add eslint-plugin-markdown 8 years ago

readme.md

unist-util-remove-position Build Status Coverage Status

Remove positions from a unist tree.

Installation

npm:

npm install unist-util-remove-position

Usage

Dependencies:

var remark = require('remark');
var removePosition = require('unist-util-remove-position');

Tree:

var tree = remark().parse('Some **strong**, _emphasis_, and `code`.');

Yields:

{ type: 'root',
  children:
   [ { type: 'paragraph',
       children:
        [ { type: 'text',
            value: 'Some ',
            position:
             Position {
               start: { line: 1, column: 1, offset: 0 },
               end: { line: 1, column: 6, offset: 5 },
               indent: [] } },
          { type: 'strong',
            children:
             [ { type: 'text',
                 value: 'strong',
                 position:
                  Position {
                    start: { line: 1, column: 8, offset: 7 },
                    end: { line: 1, column: 14, offset: 13 },
                    indent: [] } } ],
            position:
             Position {
               start: { line: 1, column: 6, offset: 5 },
               end: { line: 1, column: 16, offset: 15 },
               indent: [] } },
          { type: 'text',
            value: ', ',
            position:
             Position {
               start: { line: 1, column: 16, offset: 15 },
               end: { line: 1, column: 18, offset: 17 },
               indent: [] } },
          { type: 'emphasis',
            children:
             [ { type: 'text',
                 value: 'emphasis',
                 position:
                  Position {
                    start: { line: 1, column: 19, offset: 18 },
                    end: { line: 1, column: 27, offset: 26 },
                    indent: [] } } ],
            position:
             Position {
               start: { line: 1, column: 18, offset: 17 },
               end: { line: 1, column: 28, offset: 27 },
               indent: [] } },
          { type: 'text',
            value: ', and ',
            position:
             Position {
               start: { line: 1, column: 28, offset: 27 },
               end: { line: 1, column: 34, offset: 33 },
               indent: [] } },
          { type: 'inlineCode',
            value: 'code',
            position:
             Position {
               start: { line: 1, column: 34, offset: 33 },
               end: { line: 1, column: 40, offset: 39 },
               indent: [] } },
          { type: 'text',
            value: '.',
            position:
             Position {
               start: { line: 1, column: 40, offset: 39 },
               end: { line: 1, column: 41, offset: 40 },
               indent: [] } } ],
       position:
        Position {
          start: { line: 1, column: 1, offset: 0 },
          end: { line: 1, column: 41, offset: 40 },
          indent: [] } } ],
  position:
   { start: { line: 1, column: 1, offset: 0 },
     end: { line: 1, column: 41, offset: 40 } } }

Removing position from tree:

tree = removePosition(tree, true);

Yields:

{ type: 'root',
  children:
   [ { type: 'paragraph',
       children:
        [ { type: 'text', value: 'Some ' },
          { type: 'strong',
            children: [ { type: 'text', value: 'strong' } ] },
          { type: 'text', value: ', ' },
          { type: 'emphasis',
            children: [ { type: 'text', value: 'emphasis' } ] },
          { type: 'text', value: ', and ' },
          { type: 'inlineCode', value: 'code' },
          { type: 'text', value: '.' } ] } ] }

API

removePosition(node[, force])

Remove positions from node. If force is given, uses delete, otherwise, sets positions to undefined.

Returns

The given node.

License

MIT © Titus Wormer