markdown
markdown
Markdown to HTML conversion and RawHTML utilities.
Classes:
-
RawHTML–String subclass that bypasses markdown-to-HTML conversion.
markdown.RawHTML
Bases: str
String subclass that bypasses markdown-to-HTML conversion.
Use this to pass pre-formatted HTML directly to tooltip or popup
parameters on any add_* method.
Examples:
>>> from mapyta.markdown import RawHTML
>>> html = RawHTML("<b>Bold</b> and <em>italic</em>")
>>> m.add_point(Point(4.9, 52.37), tooltip=html)
markdown.markdown_to_html
markdown_to_html(md_text: str) -> str
Convert a subset of Markdown to HTML for popups/tooltips.
Supports **bold**, *italic*, backtick code, [links](url),
headers (# - ###), and unordered lists (- item).
Parameters:
-
md_text(str) –Markdown-formatted string.
Returns:
-
str–HTML string.
Source code in mapyta/markdown.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
markdown.sanitize_href
sanitize_href(url: str) -> str
Allow only safe URL schemes (http, https, mailto). Returns # otherwise.
Source code in mapyta/markdown.py
6 7 8 9 10 11 | |