Skip to content

Commit

Permalink
Merge pull request #53 from facelessuser/new-deps
Browse files Browse the repository at this point in the history
Prepare for new dependencies
  • Loading branch information
facelessuser authored Oct 10, 2018
2 parents ecfd5db + 2c8091d commit 1e35dc6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
19 changes: 17 additions & 2 deletions MarkdownPreview.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@
// You can't include "extra" and "superfences"
// as "fenced_code" can not be included with "superfences",
// so we include the pieces separately.
"markdown.extensions.smart_strong",
"markdown.extensions.footnotes",
"markdown.extensions.attr_list",
"markdown.extensions.def_list",
"markdown.extensions.tables",
"markdown.extensions.abbr",
"pymdownx.betterem",
{
"markdown.extensions.codehilite": {
"guess_lang": false
Expand All @@ -101,7 +101,22 @@
"markdown.extensions.admonition",

// PyMdown extensions that help give a GitHub-ish feel
"pymdownx.superfences", // Nested fences and UML support
{
"pymdownx.superfences": { // Nested fences and UML support
"custom_fences": [
{
"name": "flow",
"class": "uml-flowchart",
"format": {"!!python/name": "pymdownx.superfences.fence_code_format"}
},
{
"name": "sequence",
"class": "uml-sequence-diagram",
"format": {"!!python/name": "pymdownx.superfences.fence_code_format"}
}
]
}
},
{
"pymdownx.magiclink": { // Auto linkify URLs and email addresses
"repo_url_shortener": true,
Expand Down
5 changes: 5 additions & 0 deletions docs/src/markdown/changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes

## 2.2.1

- Add support for Markdown 3+ and Pymdownx 6+.
- Add viewport scaling in HTML.

## 2.2.0

- Add basic GitLab support.
Expand Down
9 changes: 8 additions & 1 deletion examples/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@
image_path: https://assets-cdn.github.com/images/icons/emoji/unicode/
non_standard_image_path: https://assets-cdn.github.com/images/icons/emoji/
- pymdownx.tasklist
- pymdownx.superfences
- pymdownx.superfences:
custom_fences:
- name: flow
class: uml-flowchart
format: !!python/name:pymdownx.superfences.fence_code_format
- name: sequence
class: uml-sequence-diagram
format: !!python/name:pymdownx.superfences.fence_code_format
---
test: This tests the meta extension
title: This title will be overridden by YAML
Expand Down
8 changes: 6 additions & 2 deletions markdown_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Markdown Preview wrapper."""
from __future__ import absolute_import
import traceback
from markdown import Markdown, util
from markdown import Markdown, util, version_info
from markdown.extensions import Extension


Expand All @@ -26,13 +26,17 @@ def registerExtensions(self, extensions, configs): # noqa
We are overriding this in order to gracefully handle bad extensions
and to prevent old deprecated style of 'extensions(option=value)'.
"""
md3 = version_info[0] > 2
for ext in extensions:
try:
# Make sure we aren't using old form `extension(option=value)`
if isinstance(ext, util.string_type) and ('(' not in ext):
ext = self.build_extension(ext, configs.get(ext, []))
if isinstance(ext, Extension):
ext.extendMarkdown(self, globals())
if md3:
ext._extendMarkdown(self)
else:
ext.extendMarkdown(self, globals())
elif ext is not None:
raise TypeError(
'Extension "%s.%s" must be of type: "markdown.Extension"'
Expand Down

0 comments on commit 1e35dc6

Please sign in to comment.