statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Allow Bard/Brad to be extendable by customing the sanitizer #2493

Open dannyuk1982 opened 4 years ago

dannyuk1982 commented 4 years ago

The docs on Extending Brad https://docs.statamic.com/fieldtypes/bard#extending-bard say "You are free to extend Bard or the underlying Scribe instances by adding your own plugins. You can do this by pushing a Scribe plugin function into the plugins array" but unfortunately because the sanitizer's whitelist is by default a very strict set you pragmatically can't do much.

For example, want to write a plugin that wraps text with <span class="text-red"> - you can't, because the Scribe Sanitizer plugin's whitelist won't allow span tags. You can't even switch to HTML mode and write this as it just cleans them back out.

Either allowing a way to pass the whitelist, or have something like a sanitize option which can be set to false and then anything is allowed. At the moment, unless Brad is writing really vanilla text I am finding it pretty useless compared to say Replicator, which is a shame, as the writing experience is otherwise much nicer using Brad.