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

Method validateLink

markdown_it/main.py:323–331  ·  view source on GitHub ↗

Validate if the URL link is allowed in output. This validator can prohibit more than really needed to prevent XSS. It's a tradeoff to keep code simple and to be secure by default. Note: the url should be normalized at this point, and existing entities decoded.

(self, url: str)

Source from the content-addressed store, hash-verified

321 # link methods
322
323 def validateLink(self, url: str) -> bool:
324 """Validate if the URL link is allowed in output.
325
326 This validator can prohibit more than really needed to prevent XSS.
327 It's a tradeoff to keep code simple and to be secure by default.
328
329 Note: the url should be normalized at this point, and existing entities decoded.
330 """
331 return normalize_url.validateLink(url)
332
333 def normalizeLink(self, url: str) -> str:
334 """Normalize destination URLs in links

Callers 7

TestOneInputFunction · 0.95
linkifyFunction · 0.80
autolinkFunction · 0.80
imageFunction · 0.80
linkFunction · 0.80
linkifyFunction · 0.80
referenceFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected