From e6d2015de56f65afdc5ed501c56a7e32948e1ef4 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Thu, 11 Feb 2021 19:00:36 -0600 Subject: [PATCH] use smarty markdown extension for dashes, ellipses --- incorporealcms/config.py | 10 ++++++++-- tests/test_factory.py | 14 +++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/incorporealcms/config.py b/incorporealcms/config.py index aa4530c..7c1eebb 100644 --- a/incorporealcms/config.py +++ b/incorporealcms/config.py @@ -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' diff --git a/tests/test_factory.py b/tests/test_factory.py index 973e9b7..b9d7f1f 100644 --- a/tests/test_factory.py +++ b/tests/test_factory.py @@ -23,20 +23,24 @@ def test_markdown_meta_extension_always(): assert b'Index - incorporeal.org' 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 — 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 — word' in response.data + assert b'word --- word' in response.data def test_title_override():