-
I'd like to have
to be output as text unchanged instead of making it a list. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
Looks like some of the markdown in your question is not working: See the CommonMark Help page for more on markdown. As it’s a community plugin, it might be good to ask and/or solve the problem there? Notably, there are ways to turn off constructs indeed. As your question is explained in only a few sentences, it might also be an XY problem. If you could spend more time framing your question, we might be able to offer a better solution. |
Beta Was this translation helpful? Give feedback.
-
Taking a step back for a moment.
One possibility, would be to address zestedesavoir/zmarkdown#416, allowing the plugin to work with remark 13. |
Beta Was this translation helpful? Give feedback.
-
for anyone looking for a solution to import { SKIP, visit } from 'unist-util-visit';
import type { Plugin } from 'unified';
import type { UnistNode, UnistParent } from 'node_modules/unist-util-visit/lib';
const limitedMarkdownPlugin: Plugin = () => {
return (tree, file) => {
const contents = file.toString();
visit(tree, (node: UnistNode, index, parent: UnistParent) => {
if (
index == null ||
['paragraph', 'text', 'inlineCode', 'code', 'strong', 'emphasis'].includes(node.type) ||
!node.position
) {
return true;
}
let value = contents.slice(node.position.start.offset, node.position.end.offset);
if (node.type === 'heading') {
value = `\n${value}`;
}
parent.children[index] = {
type: 'text',
value,
} as any;
return [SKIP, index] as const;
});
};
}; |
Beta Was this translation helpful? Give feedback.
Looks like some of the markdown in your question is not working: See the CommonMark Help page for more on markdown.
As it’s a community plugin, it might be good to ask and/or solve the problem there? Notably, there are ways to turn off constructs indeed.
As your question is explained in only a few sentences, it might also be an XY problem. If you could spend more time framing your question, we might be able to offer a better solution.