I've used redactor's custom formatting option before, but now I can't get anything to work. Here's what my file currently looks like:

    "buttons": [
    "formatting": ["p","blockquote"],
    "formattingAdd": {
        "h2": {
            "title": "Heading",
            "args": ["h2"]
        "h4": {
            "title": "Subheading",
            "args": ["h4"]
        "caption": {
            "title": "Caption",
            "args": ["p", "class", "caption"]        
    "buttonsAdd": ["sup", "sub"],
    "linkNewTab": true

I have the "h2" and "h4" under "formattingAdd" because I wanted them to use custom titles.

The problem is, none of my custom formats are working. The "p" and "blockquote" from "formatting" are working properly, but the other three styles don't do anything. They appear in the list, but don't restyle the text in the editor, or create the elements in the output.

Is there something in the syntax I'm missing? I'm in Craft 3, with the redactor plugin updated to the latest version.

  • Andrea, did you get this working at all in Craft3? Commented Dec 18, 2018 at 15:24
  • Yes, Andris' answer is correct, the syntax changed a little. The args should be expressed as an object instead of an array. Commented Dec 19, 2018 at 16:09

2 Answers 2


That syntax looks to be for Redactor 2. The latest versions of the redactor plugin (starting from 2.0) use Redactor 3. The syntax has changed slightly


If you encounter an "Invalid Argument – yii\base\InvalidArgumentException Syntax error." while copy-pasting from the linked documentation, make sure each key and value has quotation marks around them (instead of apostrophes or nothing at all), e.g.:

Instead of this:

"red-p-add": {
    title: 'Red Paragraph',
    api: 'module.block.format',
    args: {
        'tag': 'p',
        'class': 'red-styled'

Use this:

"red-p-add": {
    "title": "Red Paragraph",
    "api": "module.block.format",
    "args": {
        "tag": "p",
        "class": "red-styled"
  • Thanks, this helped me too.
    – Masiorama
    Commented Feb 11, 2021 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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