-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
iframe cannot be left in the markdown #19
Comments
Thanks for the report. Cool to see someone using the customizable options! I'll have a look this weekend. I think the parser is ignoring them by default, but I believe we can get around that. |
…ranslators that do not have children (closes #19)
Thanks again for the thorough report. The issue was that we pre-optimize the tree beforehand to flag as ignored any elements without any children. For speed reasons, this flag happens separately, as it allows us to save a lot of instructions by not having to ask about or instantiate any translator config, etc for these sorts of nodes. That said, I can certainly see where someone using custom translators would find this to be a hinderance. In order to maintain performance but allow this functionality, I've added the node-html-markdown/src/translator.ts Lines 79 to 85 in 07f0fa9
You should be able to accomplish what you need now in v1.1.0, via: const markdown = NodeHtmlMarkdown.translate(
sHtml,
undefined,
{
iframe: {
preserveIfEmpty: true,
postprocess: () => {
console.log("iframe found");
}
}
}
); Let me know if that doesn't work for you. |
Hej! Cheers! |
hello,
I do not find a way to let the
iframe
element in the final markdown.Would you help me understand what I am missing?
It does not seem that it finds any
iframe
element, with a<iframe/>
or<iframe></iframe>
version.Should'nt the
iframe
keytranslator
be triggered?https://codesandbox.io/s/node-html-markdowniframe-strong-test-n52nb?file=/src/index.js:234-237
Cheers!
Notes
It seems that if the
iframe
is in block version, and as content within its blocks, the iframe is found (with the setup in the link)It there anything missing in the configuration of the
iframe
translator that is missing, or should be setup differently to make it work with single html element version?The text was updated successfully, but these errors were encountered: