How to use the rehype-remark.apply function in rehype-remark

To help you get started, we’ve selected a few rehype-remark examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Mr0grog / google-docs-to-markdown / lib / rehype-to-remark-with-spaces.js View on Github external
}
    if (node.children) {
      node.children.forEach(preserveInitialSpaces);
    }
  }
  
  function recreateSpaces (node) {
    if (node.type === 'text') {
      node.value = node.value.split(spaceToken).join(' ');
    }
    if (node.children) {
      node.children.forEach(recreateSpaces);
    }
  }
  
  const convert = rehype2remark.apply(this, arguments);
  return function (tree, file) {
    preserveInitialSpaces(tree);
    const markdownTree = convert.apply(this, [tree, file]);
    recreateSpaces(markdownTree);
    return markdownTree;
  }
};

rehype-remark

rehype plugin to transform to remark

MIT
Latest version published 8 months ago

Package Health Score

73 / 100
Full package analysis

Popular rehype-remark functions