use smarty markdown extension for dashes, ellipses

This commit is contained in:
Brian S. Stephan 2021-02-11 19:00:36 -06:00
parent 56eb767e33
commit e6d2015de5
2 changed files with 17 additions and 7 deletions

View File

@ -32,13 +32,19 @@ class Config(object):
},
}
MARKDOWN_EXTENSIONS = ['extra', 'mdx_linkify', 'tables']
MARKDOWN_EXTENSIONS = ['extra', 'mdx_linkify', 'smarty', 'tables']
MARKDOWN_EXTENSION_CONFIGS = {
'extra': {
'footnotes': {
'UNIQUE_IDS': True,
},
}
},
'smarty': {
'smart_dashes': True,
'smart_quotes': False,
'smart_angled_quotes': False,
'smart_ellipses': True,
},
}
DEFAULT_PAGE_STYLE = 'light'

View File

@ -23,20 +23,24 @@ def test_markdown_meta_extension_always():
assert b'<title>Index - incorporeal.org</title>' in response.data
def test_extra_markdown_extensions_work():
"""Test we can load more extensions via config, and that they work."""
def test_custom_markdown_extensions_work():
"""Test we can change extensions via config, and that they work.
This used to test smarty, but that's added by default now, so we test
that it can be removed by overriding the option.
"""
app = create_app(instance_path=os.path.join(HERE, 'instance'))
client = app.test_client()
response = client.get('/mdash-or-triple-dash')
assert response.status_code == 200
assert b'word --- word' in response.data
assert b'word &mdash; word' in response.data
app = create_app(instance_path=os.path.join(HERE, 'instance'),
test_config={'MARKDOWN_EXTENSIONS': ['smarty']})
test_config={'MARKDOWN_EXTENSIONS': []})
client = app.test_client()
response = client.get('/mdash-or-triple-dash')
assert response.status_code == 200
assert b'word &mdash; word' in response.data
assert b'word --- word' in response.data
def test_title_override():