How to use rehype-remark - 1 common examples

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 1 year ago

Package Health Score

60 / 100
Full package analysis

Popular rehype-remark functions