diff --git a/MarkdownPreview.py b/MarkdownPreview.py index fec5187f..e5e783cc 100644 --- a/MarkdownPreview.py +++ b/MarkdownPreview.py @@ -23,7 +23,7 @@ def is_ST3(): from . import yaml from .markdown_settings import Settings from .markdown_wrapper import StMarkdown as Markdown - from .lib.markdown_preview_lib.pygments.formatters import HtmlFormatter + from .lib.markdown_preview_lib.pygments.formatters import get_formatter_by_name from .helper import INSTALLED_DIRECTORY from urllib.request import urlopen, url2pathname, pathname2url from urllib.parse import urlparse, urlunparse @@ -31,7 +31,6 @@ def is_ST3(): from urllib.parse import quote from .markdown.extensions import codehilite try: - # from pygments.styles import get_style_by_name PYGMENTS_AVAILABLE = codehilite.pygments except: PYGMENTS_AVAILABLE = False @@ -48,14 +47,13 @@ def Request(url, data, headers): import yaml from markdown_settings import Settings from markdown_wrapper import StMarkdown as Markdown - from lib.markdown_preview_lib.pygments.formatters import HtmlFormatter + from lib.markdown_preview_lib.pygments.formatters import get_formatter_by_name from helper import INSTALLED_DIRECTORY from urllib2 import Request, urlopen, HTTPError, URLError from urllib import quote, url2pathname, pathname2url from urlparse import urlparse, urlunparse import markdown.extensions.codehilite as codehilite try: - # from pygments.styles import get_style_by_name PYGMENTS_AVAILABLE = codehilite.pygments except: PYGMENTS_AVAILABLE = False @@ -491,7 +489,7 @@ def preprocessor_yaml_frontmatter(self, text): frontmatter = {} if text.startswith("---"): - m = re.search(r'^(---(.*?)---\r?\n)', text, re.DOTALL) + m = re.search(r'^(---(.*?)---[ \t]*\r?\n)', text, re.DOTALL) if m: try: frontmatter = yaml.load(m.group(2)) @@ -973,7 +971,7 @@ def get_highlight(self): highlight = '' if self.pygments_style and not self.noclasses: - highlight += '' % HtmlFormatter(style=self.pygments_style).get_style_defs('.codehilite pre') + highlight += '' % get_formatter_by_name('html', style=self.pygments_style).get_style_defs('.codehilite pre') return highlight diff --git a/lib/markdown_preview_lib/pygments/__init__.py b/lib/markdown_preview_lib/pygments/__init__.py index c5249241..be6db19f 100755 --- a/lib/markdown_preview_lib/pygments/__init__.py +++ b/lib/markdown_preview_lib/pygments/__init__.py @@ -27,7 +27,7 @@ """ from __future__ import absolute_import -__version__ = '2.0pre' +__version__ = '2.0.1' __docformat__ = 'restructuredtext' __all__ = ['lex', 'format', 'highlight'] diff --git a/lib/markdown_preview_lib/pygments/cmdline.py b/lib/markdown_preview_lib/pygments/cmdline.py index 2c634aaf..d265e4a0 100755 --- a/lib/markdown_preview_lib/pygments/cmdline.py +++ b/lib/markdown_preview_lib/pygments/cmdline.py @@ -29,7 +29,7 @@ USAGE = """\ Usage: %s [-l | -g] [-F [:]] [-f ] - [-O ] [-P ] [-o ] [] + [-O ] [-P ] [-s] [-o ] [] %s -S