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

Method getRules

markdown_it/ruler.py:255–267  ·  view source on GitHub ↗

Return array of active functions (rules) for given chain name. It analyzes rules configuration, compiles caches if not exists and returns result. Default chain name is `''` (empty string). It can't be skipped. That's done intentionally, to keep signature monomorphic for high

(self, chainName: str = "")

Source from the content-addressed store, hash-verified

253 return result
254
255 def getRules(self, chainName: str = "") -> list[RuleFuncTv]:
256 """Return array of active functions (rules) for given chain name.
257 It analyzes rules configuration, compiles caches if not exists and returns result.
258
259 Default chain name is `''` (empty string). It can't be skipped.
260 That's done intentionally, to keep signature monomorphic for high speed.
261
262 """
263 if self.__cache__ is None:
264 self.__compile__()
265 assert self.__cache__ is not None
266 # Chain can be empty, if rules disabled. But we still have to return Array.
267 return self.__cache__.get(chainName, []) or []
268
269 def get_all_rules(self) -> list[str]:
270 """Return all available rule names."""

Callers 11

tokenizeMethod · 0.80
skipTokenMethod · 0.80
tokenizeMethod · 0.80
parseMethod · 0.80
processMethod · 0.80
list_blockFunction · 0.80
blockquoteFunction · 0.80
getNextLineFunction · 0.80
tableFunction · 0.80
paragraphFunction · 0.80
lheadingFunction · 0.80

Calls 1

__compile__Method · 0.95

Tested by

no test coverage detected