-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about custom renderer #743
Comments
Maybe something like:
ps: check that we would need to add data-ids to all nodes, includings children nodes. |
If I am able to include the |
I was able to add this extra attribute but I had to override all methods for each node type. If you guys think this feature will be useful for the core, I can create a PR for that. |
Hi @paulocheque, |
Hello. See #956 The current vision for Marked as I see it: A high-speed, low-level library for converting Markdown to HTML and back again. Admittedly I don't know enough about how Marked works to explain things in the literal; so, hopefully, this makes sense. var marked = require();
var markdown = 'Hello, World!';
var html = marked.toHtml(markdown);
// result: <p>Hello, World!</p>
var markdown = marked.toMarkdown(html);
// result: Hello, World! According to the Markdown spec, we should be able to process strings containing Markdown and HTML. For security, this should be turned off by default. Therefore, out of the box, any non-markdown would be stripped; which would include Therefore, you could opt-in, and take responsibility for: marked.allowMarkup = true;
var mixed = '<p><span data-id="something">Hello</span>, World!</p>\n\nHello again!';
var html = marked.toHtml(mixed);
// result: <p><span data-id="something">Hello</span>, World!</p><p>Hello again!</p>
var markdown = marked.toMarkdown(html);
// result: <p><span data-id="something">Hello</span>, World!</p>\n\nHello again! Is this an accurate representation of expectation and sticking to the vision statement? Even if the code is wholly incorrect. |
Closing as no follow-up conversation of discussion as of today. |
I would like to add an attribute
data-id
to EVERY html node generated by marked. Is that possible?Maybe with
var renderer = new marked.Renderer();
, but I did not find the way to get ALL nodes.The text was updated successfully, but these errors were encountered: