Open argenos opened 3 years ago
Using the commonmark rules as an example, I'm trying to do this:
Allow a rule to specify whether it wants its content escaped or not
Based on those examples, I tried the following with no success:
converter.addRule('p', {
filter: 'p',
replacement: function (content) {
return '\n\n' + content + '\n\n'
},
escapeContent: function() {
return false;
},
})
convert.emphasis = {
filter: ['em', 'i'],
replacement: function (content, node, options) {
if (!content.trim()) return ''
return options.emDelimiter + content + options.emDelimiter
},
escapeContent: function() {
return false;
},
}
Just checking if this is possible with rules or if I might be missing something obvious. Thanks!
Edit: Caught one mistake from copy-pasting and the code above now works. The only remaining question is if there is a way to turn off escaping altogether in a setting, instead of having to redefine each rule and adding the escapeContent
field.
I'm wondering if it's possible to create a rule that prevents the brackets in
[[links]]
from being escaped?Here is a sample text:
I don't necessarily know in advance which tags will contain the
[[links]]
either. Any tips?