allowed_settings_mode: "extend" or "replace". default: "replace"
Previously allowed_tags and allowed_styles would get extended, and allowed_attributes would extend where new keys were added, and replace where keys existed. Now they all extend by default, and in replace mode everything gets replaced by what is provided in settings.
e.g.
WAGTAILMARKDOWN = {
"allowed_tags": ["code"],
"allowed_styles": ["something"],
"allowed_attributes": {"*": ["data-toggle"], "code": ["data-lang"]},
"allowed_settings_mode": "extend", # optional. Possible values: "extend" or "replace". Defaults to "extend".
}
would result in default tags + "code", default styles + "something". Default allowed attributes would have {"": ["data-toggle"], "code": ["data-lang"], ...}added, but now they are{"": ["class", "style", "id", "data-toggle"], "code": ["data-lang"], ...}as expected from extend. With replace: allowed tags:["code"], styles:["something"], and attributes: {"*": ["data-toggle"], "code": ["data-lang"]}
extension*
extensions_settings_mode: "extend" or "replace". default: "replace"
e.g. with:
WAGTAILMARKDOWN = {
"extensions": ["pymdownx.arithmatex"],
"extension_configs": {
"pymdownx.arithmatex": {"generic": True}
},
"extensions_settings_mode": "extend", # optional. Possible values: "extend" or "replace". Defaults to "extend".
}
extend
replace
pymdownx.arithmatex gets added to the list of default extensions
pymdownx.arithmatex is the only extension
extension_configs get the additional configuration for pymdownx.arithmatex
extension_configs only has the configuration for pymdownx.arithmatex
Defaults to
extend
, but can alsoreplace
.allowed_*
allowed_settings_mode
: "extend" or "replace". default: "replace"Previously
allowed_tags
andallowed_styles
would get extended, andallowed_attributes
would extend where new keys were added, and replace where keys existed. Now they all extend by default, and in replace mode everything gets replaced by what is provided in settings.e.g.
would result in default tags + "code", default styles + "something". Default allowed attributes would have {"": ["data-toggle"], "code": ["data-lang"], ...}
added, but now they are
{"": ["class", "style", "id", "data-toggle"], "code": ["data-lang"], ...}as expected from extend. With replace: allowed tags:
["code"], styles:
["something"], and attributes: {"*": ["data-toggle"], "code": ["data-lang"]}
extension*
extensions_settings_mode
: "extend" or "replace". default: "replace"e.g. with:
pymdownx.arithmatex
gets added to the list of default extensionspymdownx.arithmatex
is the only extensionextension_configs
get the additional configuration forpymdownx.arithmatex
extension_configs
only has the configuration forpymdownx.arithmatex