@uiw/react-markdown-preview
Version:
React component preview markdown text in web browser. The minimal amount of CSS to replicate the GitHub Markdown style.
20 lines • 588 B
JavaScript
import { visit } from 'unist-util-visit';
export var retrieveMeta = function retrieveMeta(options) {
if (options === void 0) {
options = {};
}
return tree => {
visit(tree, node => {
if (node.type === 'element' && node.tagName === 'code' && node.properties && node.properties['dataMeta']) {
if (!node.data) {
node.data = {};
}
var metaString = node.properties['dataMeta'];
if (typeof metaString === 'string') {
node.data.meta = metaString;
}
delete node.properties['dataMeta'];
}
});
};
};