I would like to add the 'code' tag to the formatting drop-down. My rich text field is using Standard.json and I am able to remove the current tags, but it's not letting me add additional tags. I have tried adding 'code' like this in my Standard.json file:

formattingTags: ['p', 'blockquote', 'pre', 'code', 'h1', 'h2' 'h3', 'h4', 'h5']

Any thoughts?

(I realize 'pre' and 'code' are similar but if possible I would like to use code to be semantic.)

1 Answer 1


Might formattingAdd be something you can use for this? Not tested, just a quick look at Redactor's options page.

formattingAdd: [
        tag: 'code',
        title: 'Code'
  • It did not work when putting it into my Standard.json file. Maybe I'm putting it in the wrong place? Oct 2, 2014 at 22:48
  • Did you select Standard as the config setting for your field?
    – Paul
    Oct 3, 2014 at 8:16
  • Yeah. I know it's using the Standard.json file because I can remove existing tags and they are removed from the drop-down. No worries though. I've settled for using 'pre' and it works fine. Thanks for your help! Oct 3, 2014 at 15:20
  • 1
    This doesn't work because Craft is not yet on Redactor 10.0. Probably just a matter of time though. Nice find, Paul!
    – carlcs
    Oct 5, 2014 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.