You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your intention is just to use just plain text content, which seems likely, then it is better to avoid the rendered content completely in your rule. So your example would look like
turndownService.addRule('pre',{filter: 'pre',replacement: function(content,node){// Note this is not bulletproof, see below.return'```\n'+node.textContent+'\n```'}});
To make it bulletproof, you need to deal with eventual fence string (```), which may occur within <pre>, and there are also a few considerations regarding leading and trailing newlines. All these things should now be covered in the standard fencedCodeBlock rule: https://github.com/domchristie/turndown/blob/master/src/commonmark-rules.js#L111
TurndownService.prototype.escape
I add a rule for pre, how to avoid escape for pre?
The text was updated successfully, but these errors were encountered: