| 1 |
# 6.0 Migration Notes {: #\6.0} |
| 2 |
|
| 3 |
## Overview |
| 4 |
|
| 5 |
While there are a number of new features and bug fixes, the only backwards incompatible changes are with SuperFences' |
| 6 |
custom fences. In an effort to make custom fences more useful, we wanted to be able to pass the `Markdown` object to the |
| 7 |
formatters. This gives custom formats access to things like metadata if required. |
| 8 |
|
| 9 |
The format of custom fence formatters already had two different versions: ones without custom options and one with |
| 10 |
custom options. As adding yet another parameter would cause more complexity behind the scenes, we decided to introduce |
| 11 |
the breaking change of creating a unified format for formatters with custom options and without. In addition to unifying |
| 12 |
the format, we also now pass the `Markdown` object to the formatters as an additional parameter. |
| 13 |
|
| 14 |
While we were breaking custom formats, it seemed like a good time to go ahead and change the defaults for the |
| 15 |
`custom_fences` options. Most people who are using SuperFences aren't even using the default, niche `flow` and |
| 16 |
`sequence` custom fences. Instead of hijacking fence names that most people aren't even using, it seemed more |
| 17 |
appropriate to define no custom fences. |
| 18 |
|
| 19 |
Below are instructions on how to upgrade if you were relying on the either the default settings of `custom_fences` or if |
| 20 |
you had written your own custom fence formatters. |
| 21 |
|
| 22 |
1. If you've written your own custom fence formatters, the number of parameters needed has changed, so you must update |
| 23 |
your existing formatters. The needed parameters are the same regardless of whether you are using an options |
| 24 |
validator or not. |
| 25 |
|
| 26 |
```py3 |
| 27 |
def custom_formatter(source, language, css_class, options, md): |
| 28 |
return string |
| 29 |
``` |
| 30 |
|
| 31 |
2. `flow` and `sequence` are no longer defined by default. If you were relying on the default custom fences, you will |
| 32 |
have to define them manually now. The needed settings are found below: |
| 33 |
|
| 34 |
```py3 |
| 35 |
extension_configs = { |
| 36 |
"pymdownx.superfences": { |
| 37 |
"custom_fences": [ |
| 38 |
{ |
| 39 |
'name': 'flow', |
| 40 |
'class': 'uml-flowchart', |
| 41 |
'format': pymdownx.superfences.fence_code_format |
| 42 |
}, |
| 43 |
{ |
| 44 |
'name': 'sequence', |
| 45 |
'class': 'uml-sequence-diagram', |
| 46 |
'format': pymdownx.superfences.fence_code_format |
| 47 |
} |
| 48 |
] |
| 49 |
} |
| 50 |
} |
| 51 |
``` |
| 52 |
|
| 53 |
If you are attempting to configure these options in a YAML based configuration (like in [MkDocs][mkdocs]), please |
| 54 |
see the [FAQ](../../faq.md#function-references-in-yaml) to see how to specify function references in YAML. |