"""Public page markup from the v2.3.0 style pass"""
import markdown
import pytest
from starpunk import create_app
from starpunk.models import MARKDOWN_EXTENSIONS
from starpunk.notes import create_note
def md(text):
return markdown.markdown(text, extensions=MARKDOWN_EXTENSIONS)
@pytest.mark.parametrize("text, expected", [
("see https://sqlite.org/x.html.", 'https://sqlite.org/x.html.'),
("(https://a.example/p)", '(https://a.example/p)'),
("[label](https://a.example)", 'label'),
("`https://code.example`", "https://code.example"),
])
def test_bare_urls_are_linked(text, expected):
assert expected in md(text)
def test_url_as_link_label_is_not_nested():
assert md("[https://b.example](https://b.example)").count("My Notes' in html
assert 'class="p-category" rel="tag"' in html
# Notes' metadata is not styled as the page footer
assert html.count('