summaryrefslogtreecommitdiff
path: root/tests/extensions
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2020-06-23 16:04:31 -0400
committerGitHub <noreply@github.com>2020-06-23 16:04:31 -0400
commit10058fae6577e79b786f4e185218aebb1b53e937 (patch)
treee57b70fa1f83d89bd9e8db31bc1ab18f4f91ddf2 /tests/extensions
parentdbb9b3d766e847f1909fa0c92c6b997f0e7c868d (diff)
downloadpython-markdown-10058fae6577e79b786f4e185218aebb1b53e937.tar.gz
Refactor fenced_code & codehilite options (#816)
* Add `language-` prefix to output when syntax highlighting is disabled for both codehilite and fenced_code extensions. * Add `lang_prefix` config option to customize the prefix. * Add a 'pygments' env to tox which runs the tests with Pygments installed. Pygments is locked to a specific version in the env. * Updated codehilite to accept any Pygments options. * Refactor fenced code attributes. - ID attr is defined on `pre` tag. - Add support for attr_list extension, which allows setting arbitrary attributes. - When syntax highlighting is enabled, any pygments options can be defined per block in the attr list. - For backward compatibility, continue to support `hi_lines` outside of an attr_list. That is the only attr other than lang which is allowed without the brackets (`{}`) of an attr list. Note that if the brackets exist, then everything, including lang and hl_lines, must be within them. * Resolves #775. Resolves #334. Addresses #652.
Diffstat (limited to 'tests/extensions')
-rw-r--r--tests/extensions/fenced_code.html32
-rw-r--r--tests/extensions/fenced_code.txt34
-rw-r--r--tests/extensions/github_flavored.html4
3 files changed, 2 insertions, 68 deletions
diff --git a/tests/extensions/fenced_code.html b/tests/extensions/fenced_code.html
deleted file mode 100644
index 7b86e79..0000000
--- a/tests/extensions/fenced_code.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<p>index 0000000..6e956a9</p>
-<pre><code>--- /dev/null
-+++ b/test/data/stripped_text/mike-30-lili
-@@ -0,0 +1,27 @@
-+Summary:
-+ drift_mod.py | 1 +
-+ 1 files changed, 1 insertions(+), 0 deletions(-)
-+
-+commit da4bfb04debdd994683740878d09988b2641513d
-+Author: Mike Dirolf &lt;mike@dirolf.com&gt;
-+Date: Tue Jan 17 13:42:28 2012 -0500
-+
-+```
-+minor: just wanted to push something.
-+```
-+
-+diff --git a/drift_mod.py b/drift_mod.py
-+index 34dfba6..8a88a69 100644
-+
-+```
-+--- a/drift_mod.py
-++++ b/drift_mod.py
-+@@ -281,6 +281,7 @@ CONTEXT_DIFF_LINE_PATTERN = re.compile(r'^('
-+ '|\+ .*'
-+ '|- .*'
-+ ')$')
-++
-+ def wrap_context_diffs(message_text):
-+ return _wrap_diff(CONTEXT_DIFF_HEADER_PATTERN,
-+ CONTEXT_DIFF_LINE_PATTERN,
-+```
-</code></pre> \ No newline at end of file
diff --git a/tests/extensions/fenced_code.txt b/tests/extensions/fenced_code.txt
deleted file mode 100644
index 73c0337..0000000
--- a/tests/extensions/fenced_code.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-index 0000000..6e956a9
-
-```
---- /dev/null
-+++ b/test/data/stripped_text/mike-30-lili
-@@ -0,0 +1,27 @@
-+Summary:
-+ drift_mod.py | 1 +
-+ 1 files changed, 1 insertions(+), 0 deletions(-)
-+
-+commit da4bfb04debdd994683740878d09988b2641513d
-+Author: Mike Dirolf <mike@dirolf.com>
-+Date: Tue Jan 17 13:42:28 2012 -0500
-+
-+```
-+minor: just wanted to push something.
-+```
-+
-+diff --git a/drift_mod.py b/drift_mod.py
-+index 34dfba6..8a88a69 100644
-+
-+```
-+--- a/drift_mod.py
-++++ b/drift_mod.py
-+@@ -281,6 +281,7 @@ CONTEXT_DIFF_LINE_PATTERN = re.compile(r'^('
-+ '|\+ .*'
-+ '|- .*'
-+ ')$')
-++
-+ def wrap_context_diffs(message_text):
-+ return _wrap_diff(CONTEXT_DIFF_HEADER_PATTERN,
-+ CONTEXT_DIFF_LINE_PATTERN,
-+```
-```
diff --git a/tests/extensions/github_flavored.html b/tests/extensions/github_flavored.html
index 063303a..b39165a 100644
--- a/tests/extensions/github_flavored.html
+++ b/tests/extensions/github_flavored.html
@@ -1,5 +1,5 @@
<p>index 0000000..6e956a9</p>
-<pre><code class="diff">--- /dev/null
+<pre><code class="language-diff">--- /dev/null
+++ b/test/data/stripped_text/mike-30-lili
@@ -0,0 +1,27 @@
+Summary:
@@ -32,7 +32,7 @@
</code></pre>
<p>Test support for foo+bar lexer names.</p>
-<pre><code class="html+jinja">&lt;title&gt;{% block title %}{% endblock %}&lt;/title&gt;
+<pre><code class="language-html+jinja">&lt;title&gt;{% block title %}{% endblock %}&lt;/title&gt;
&lt;ul&gt;
{% for user in users %}
&lt;li&gt;&lt;a href=&quot;{{ user.url }}&quot;&gt;{{ user.username }}&lt;/a&gt;&lt;/li&gt;