Skip to content

Commit fecb4b8

Browse files
committed
refactor: API should take precendence
1 parent 5c7be8c commit fecb4b8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

mdformat_mkdocs/_helpers.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ def separate_indent(line: str) -> tuple[str, str]:
5252

5353
def get_conf(options: ContextOptions, key: str) -> bool | str | int | None:
5454
"""Read setting from mdformat configuration Context."""
55-
cli_or_toml = (
55+
if (api := options["mdformat"].get(key)) is not None:
56+
return api # From API
57+
return (
5658
options["mdformat"].get("plugin", {}).get(__plugin_name__, {}).get(key)
57-
)
58-
if cli_or_toml is None:
59-
return options["mdformat"].get(key) # From API
60-
return cli_or_toml
59+
) # from cli_or_toml

0 commit comments

Comments
 (0)