Module

plugins.autolinks

Autolinks plugin for Patitas.

Adds support for automatic URL and email detection.

Usage:

>>> md = create_markdown(plugins=["autolinks"])
>>> md("Visit https://example.com for more info.")
'<p>Visit <a href="https://example.com">https://example.com</a> for more info.</p>'

Syntax:

URLs are automatically linked:

  • http://example.com
  • https://example.com
  • www.example.com

Emails are automatically linked:

  • user@example.com

Explicit autolinks (CommonMark):

Notes:

  • URLs in code spans are not autolinked
  • URLs in explicit links are not double-linked
  • Trailing punctuation is handled smartly

Thread Safety:

This plugin is stateless and thread-safe.

Classes

AutolinksPlugin 4
Plugin for automatic URL and email linking. Extends inline parsing to detect URLs and emails witho…

Plugin for automatic URL and email linking.

Extends inline parsing to detect URLs and emails without explicit markdown link syntax.

Methods

name 0 str
property
def name(self) -> str
Returns
str
extend_lexer 1
No lexer extension needed.
def extend_lexer(self, lexer_class: type[Lexer]) -> None
Parameters
Name Type Description
lexer_class
extend_parser 1
Enable autolink detection in inline parser.
def extend_parser(self, parser_class: type[Parser]) -> None
Parameters
Name Type Description
parser_class
extend_renderer 1
Autolink rendering uses standard link rendering.
def extend_renderer(self, renderer_class: type[HtmlRenderer]) -> None
Parameters
Name Type Description
renderer_class