There seems to be a conflict between my custom inline parser and image tags.
This is my code:
const copyOpen = '[copy]';
const copyClose = '[/copy]';
export const CopyExtension: MarkdownConfig = {
defineNodes: [NodeTypes.copy, NodeTypes.copyTag],
parseInline: [{
name: NodeTypes.copy,
parse(cx: InlineContext, next: number, pos: number) {
const isOpenTag = cx.slice(pos, pos + copyOpen.length) === copyOpen;
const isCloseTag = cx.slice(pos, pos + copyClose.length) === copyClose;
if (isOpenTag) {
return cx.addDelimiter(CopyDelim, pos, pos + copyOpen.length, true, false);
} else if (isCloseTag) {
return cx.addDelimiter(CopyDelim, pos, pos + copyClose.length, false, true);
}
return -1;
},
after: NodeTypes.italic,
}],
props: [
styleTags({
[NodeTypes.copyTag]: tags.special(CustomTags.CopyTag),
[NodeTypes.copy]: tags.special(CustomTags.Copy),
}),
],
};
Since it is parsed after Italic it should be parsed before images. If I set it to be before image it gets interpreted as a link.
I don't see what else can be done on my end to fix this.
There seems to be a conflict between my custom inline parser and image tags.
This is my code:
This issue is that my copy tag gets mistaken for on image when placing a
!character before the closing tag.Since it is parsed after Italic it should be parsed before images. If I set it to be before image it gets interpreted as a link.
I don't see what else can be done on my end to fix this.
Here are some screenshots of the behaviour:

