MCPcopy Create free account
hub / github.com/executablebooks/markdown-it-py / enableOnly

Method enableOnly

markdown_it/ruler.py:215–229  ·  view source on GitHub ↗

Enable rules with given names, and disable everything else. :param names: name or list of rule names to enable. :param ignoreInvalid: ignore errors when rule not found :raises: KeyError if name not found and not ignoreInvalid :return: list of found rule names

(
        self, names: str | Iterable[str], ignoreInvalid: bool = False
    )

Source from the content-addressed store, hash-verified

213 return result
214
215 def enableOnly(
216 self, names: str | Iterable[str], ignoreInvalid: bool = False
217 ) -> list[str]:
218 """Enable rules with given names, and disable everything else.
219
220 :param names: name or list of rule names to enable.
221 :param ignoreInvalid: ignore errors when rule not found
222 :raises: KeyError if name not found and not ignoreInvalid
223 :return: list of found rule names
224 """
225 if isinstance(names, str):
226 names = [names]
227 for rule in self.__rules__:
228 rule.enabled = False
229 return self.enable(names, ignoreInvalid)
230
231 def disable(
232 self, names: str | Iterable[str], ignoreInvalid: bool = False

Callers 2

configureMethod · 0.80
reset_rulesMethod · 0.80

Calls 1

enableMethod · 0.95

Tested by

no test coverage detected