8000
Is there any way to change the default protocol used?
For example: "google.com" -> "http://google.com/"
Just overriding the default function of linkify.normalize:
linkify.normalize
from markdown_it import MarkdownIt md = MarkdownIt("commonmark", {"breaks": True, "html": True, "linkify": True}).enable( ["linkify"] ) a = "link to somewhere.com" print(md.render(a)) # <p>link to <a href="http://somewhere.com">somewhere.com</a></p> def normalize(match): """Override default normalize""" if not match.schema: match.url = "https://" + match.url if match.schema == "mailto:" and not re.search( "^mailto:", match.url, flags=re.IGNORECASE ): match.url = "mailto:" + match.url md.linkify.normalize = normalize print(md.render(a)) # <p>link to <a href="https://somewhere.com">somewhere.com</a></p>
Ref: Change default protocol in fuzzyLink option
There was an error while loading. Please reload this page.