From e07d450cdb4d22ae44177210a608211d1efc24eb Mon Sep 17 00:00:00 2001 From: facelessuser Date: Sun, 18 Oct 2015 13:17:41 -0600 Subject: [PATCH 01/12] Fix absolute URL handling Fix #296 --- MarkdownPreview.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MarkdownPreview.py b/MarkdownPreview.py index 4cdb4fa9..aa960f96 100644 --- a/MarkdownPreview.py +++ b/MarkdownPreview.py @@ -276,11 +276,14 @@ def repl_relative(m, base_path, relative_path): def repl_absolute(m, base_path): """ Replace path with absolute path """ link = m.group(0) - scheme, netloc, path, params, query, fragment, is_url, is_absolute = parse_url(m.group('path')[1:-1]) - path = url2pathname(path) + try: + scheme, netloc, path, params, query, fragment, is_url, is_absolute = parse_url(m.group('path')[1:-1]) + except Exception: + return link if (not is_absolute and not is_url): + path = url2pathname(path) temp = os.path.normpath(os.path.join(base_path, path)) if os.path.exists(temp): path = pathname2url(temp.replace("\\", "/")) From 26874fe14e023e3e8a2741f44583c85e84128e7e Mon Sep 17 00:00:00 2001 From: facelessuser Date: Sun, 18 Oct 2015 13:25:41 -0600 Subject: [PATCH 02/12] Merge kbd for shortcuts ref: #276 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5e21a4b7..4e94ddcd 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ You can use builtin [python-markdown][10] parser or use the [github markdown API For all Sublime Text 2/3 users we recommend install via [Package Control][3]. 1. [Install][11] Package Control if you haven't yet. -2. Use `cmd+shift+P` then `Package Control: Install Package` +2. Use cmd+shift+P then `Package Control: Install Package` 3. Look for `Markdown Preview` and install it. ### Manual Install @@ -59,7 +59,7 @@ For all Sublime Text 2/3 users we recommend install via [Package Control][3]. ### To preview : - optionally select some of your markdown for conversion - - use `cmd+shift+P` then `Markdown Preview` to show the follow commands (you will be prompted to select which parser you prefer): + - use cmd+shift+P then `Markdown Preview` to show the follow commands (you will be prompted to select which parser you prefer): - Markdown Preview: Preview in Browser - Markdown Preview: Export HTML in Sublime Text - Markdown Preview: Copy to Clipboard @@ -70,7 +70,7 @@ For all Sublime Text 2/3 users we recommend install via [Package Control][3]. ### To build : - - Just use `Ctrl+B` (Windows/Linux) or `cmd+B` (Mac) to build current file. + - Just use ctrl+B (Windows/Linux) or cmd+B (Mac) to build current file. ### To config : From 64cfa5ec7e4fc77d655cef501bd6e3cb77aed1ef Mon Sep 17 00:00:00 2001 From: facelessuser Date: Sun, 18 Oct 2015 13:28:36 -0600 Subject: [PATCH 03/12] Fix document links to 3rd party extensions --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4e94ddcd..2d555c59 100644 --- a/README.md +++ b/README.md @@ -27,15 +27,15 @@ You can use builtin [python-markdown][10] parser or use the [github markdown API | Extension | Documentation | |-----------|---------------| - | magiclink | Find and convert HTML links and email address to links ([MagicLink Documentation](http://facelessuser.github.io/PyMdown/extensions/magiclink/)). | + | magiclink | Find and convert HTML links and email address to links ([MagicLink Documentation](http://facelessuser.github.io/pymdown-extensions/extensions/magiclink/)). | | delete | Surround inline text with `~~crossed out~~` to get del tags ~~crossed out~~. | | insert | Surround inline text with `^^underlined^^` to get ins tags underlined. | - | tasklist | Github Flavored Markdown tasklists ([Tasklist Documentation](http://facelessuser.github.io/PyMdown/extensions/tasklist/)). | - | githubemoji | Support for Github Flavored Markdown emojis ([GithubEmoji Documentation](http://facelessuser.github.io/PyMdown/extensions/githubemoji/)). | - | headeranchor | Github Flavored Markdown style header anchors ([HeaderAnchor Documentation](http://facelessuser.github.io/PyMdown/extensions/headeranchor/)). | + | tasklist | Github Flavored Markdown tasklists ([Tasklist Documentation](http://facelessuser.github.io/pymdown-extensions/extensions/tasklist/)). | + | githubemoji | Support for Github Flavored Markdown emojis ([GithubEmoji Documentation](http://facelessuser.github.io/pymdown-extensions/extensions/githubemoji/)). | + | headeranchor | Github Flavored Markdown style header anchors ([HeaderAnchor Documentation](http://facelessuser.github.io/pymdown-extensions/extensions/headeranchor/)). | | github | A convenience extension to add: `magiclink`, `delete`, `tasklist`, `githubemoji`, `headeranchor`, `superfences`, and `nl2br` to parse and display Markdown in a github-ish way. It is recommed to pair `github` with `extra` and `codehilite` (with language guessing off) to parse close to github's way. Be aware of what extensions `github` loads, because you should not load extensions more than once. | - | progressbar | Create progress bars ([ProgressBar Documentation](http://facelessuser.github.io/PyMdown/extensions/progressbar/)). | - | superfences | Allow fenced blocks to be nested under lists, blockquotes, etc. and add special UML diagram blocks ([SuperFences Documentation](http://facelessuser.github.io/PyMdown/extensions/superfences/)). | + | progressbar | Create progress bars ([ProgressBar Documentation](http://facelessuser.github.io/pymdown-extensions/extensions/progressbar/)). | + | superfences | Allow fenced blocks to be nested under lists, blockquotes, etc. and add special UML diagram blocks ([SuperFences Documentation](http://facelessuser.github.io/pymdown-extensions/extensions/superfences/)). | ## Installation : From 497257cc047373aada640c2c8e7a95257c672bdb Mon Sep 17 00:00:00 2001 From: facelessuser Date: Sun, 18 Oct 2015 13:31:15 -0600 Subject: [PATCH 04/12] Use more common `strike through` instead of `crossed out` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d555c59..d75db117 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ You can use builtin [python-markdown][10] parser or use the [github markdown API | Extension | Documentation | |-----------|---------------| | magiclink | Find and convert HTML links and email address to links ([MagicLink Documentation](http://facelessuser.github.io/pymdown-extensions/extensions/magiclink/)). | - | delete | Surround inline text with `~~crossed out~~` to get del tags ~~crossed out~~. | + | delete | Surround inline text with `~~strike through~~` to get del tags ~~strike through~~. | | insert | Surround inline text with `^^underlined^^` to get ins tags underlined. | | tasklist | Github Flavored Markdown tasklists ([Tasklist Documentation](http://facelessuser.github.io/pymdown-extensions/extensions/tasklist/)). | | githubemoji | Support for Github Flavored Markdown emojis ([GithubEmoji Documentation](http://facelessuser.github.io/pymdown-extensions/extensions/githubemoji/)). | From 0fcea1424f33217ccee550ba69d5346ebd13a9d6 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Sat, 14 Nov 2015 08:47:45 -0700 Subject: [PATCH 05/12] Generic external markdown parser class - Remove the multimarkdown specific class and options in favor of a new generic parser class that can theoretically launch any external markdown parser. --- MarkdownPreview.py | 47 +++++++++++++++++++++----------- MarkdownPreview.sublime-settings | 24 ++++++++++++---- README.md | 2 +- 3 files changed, 51 insertions(+), 22 deletions(-) diff --git a/MarkdownPreview.py b/MarkdownPreview.py index aa960f96..c485b746 100644 --- a/MarkdownPreview.py +++ b/MarkdownPreview.py @@ -928,18 +928,23 @@ def parser_specific_convert(self, markdown_text): return markdown_html -class MultiMarkdownCompiler(Compiler): +class ExternalMarkdownCompiler(Compiler): default_css = "markdown.css" + def __init__(self, parser): + """Initialize.""" + + self.parser = parser + super(ExternalMarkdownCompiler, self).__init__() + def parser_specific_convert(self, markdown_text): import subprocess - binary = self.settings.get("multimarkdown_binary", "") - if os.path.exists(binary): - cmd = [binary] - critic_mode = self.settings.get("strip_critic_marks", "accept") - if critic_mode in ("accept", "reject"): - cmd.append('-a' if critic_mode == "accept" else '-r') - sublime.status_message('converting markdown with multimarkdown...') + settings = sublime.load_settings("MarkdownPreview.sublime-settings") + binary = settings.get('markdown_binary_map', {})[self.parser] + + if len(binary) and os.path.exists(binary[0]): + cmd = binary + sublime.status_message('converting markdown with %s...' % self.parser) if sublime.platform() == "windows": startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW @@ -961,7 +966,7 @@ def parser_specific_convert(self, markdown_text): print(markdown_html) markdown_html = _CANNOT_CONVERT else: - sublime.error_message("Cannot find multimarkdown binary!") + sublime.error_message("Cannot find % binary!" % self.binary) markdown_html = _CANNOT_CONVERT return markdown_html @@ -1070,15 +1075,20 @@ def parser_specific_convert(self, markdown_text): class MarkdownPreviewSelectCommand(sublime_plugin.TextCommand): def run(self, edit, target='browser'): + + settings = sublime.load_settings("MarkdownPreview.sublime-settings") + md_map = settings.get('markdown_binary_map', {}) parsers = [ "markdown", - "github", - "multimarkdown" + "github" ] + # Add external markdown binaries. + for k in md_map.keys(): + parsers.append(k) + self.target = target - settings = sublime.load_settings("MarkdownPreview.sublime-settings") enabled_parsers = set() for p in settings.get("enabled_parsers", ["markdown", "github"]): if p in parsers: @@ -1122,9 +1132,12 @@ def run(self, edit, parser='markdown', target='browser'): if parser == "github": compiler = GithubCompiler() - elif parser == "multimarkdown": - compiler = MultiMarkdownCompiler() + elif parser == 'markdown': + compiler = MarkdownCompiler() + elif parser in settings.get("enabled_parsers", ("markdown", "github")): + compiler = ExternalMarkdownCompiler(parser) else: + # Fallback to Python Markdown compiler = MarkdownCompiler() html, body = compiler.run(self.view, preview=(target in ['disk', 'browser'])) @@ -1262,8 +1275,10 @@ def run(self): if parser == "github": compiler = GithubCompiler() - elif parser == "multimarkdown": - compiler = MultiMarkdownCompiler() + elif parser == 'markdown': + compiler = MarkdownCompiler() + elif parser in settings.get("enabled_parsers", ("markdown", "github")): + compiler = ExternalMarkdownCompiler(parser) else: compiler = MarkdownCompiler() diff --git a/MarkdownPreview.sublime-settings b/MarkdownPreview.sublime-settings index 16e037eb..782fd2fa 100644 --- a/MarkdownPreview.sublime-settings +++ b/MarkdownPreview.sublime-settings @@ -113,6 +113,23 @@ */ "enabled_parsers": ["markdown", "github"], + /* + Custom external markdown parsers. + + "markdown_binary_map" contains key values pairs. The key + is name of the parser and what is used in "enabled_parsers" + to turn on the access to the parser. The value is an array + containing the path to the binary and all the parameters that + are desired. + + Multimarkdown is provided as an example below. It's path may differ + on your system. + */ + + "markdown_binary_map": { + "multimarkdown": ["/usr/local/bin/multimarkdown"] + }, + /* Default mode for the github Markdown parser : markdown (documents) or gfm (comments) see http://developer.github.com/v3/markdown/#render-an-arbitrary-markdown-document @@ -195,11 +212,6 @@ */ // "path_tempfile": "/tmp/my_notes", - /* - Absolute path to multimarkdown executable - */ - "multimarkdown_binary": "", - /* Sets HTML output to a simple form: - No head @@ -237,6 +249,8 @@ accept: Accepts the proposed inserts and deletions (comments etc. are discarded) reject: Rejects the proposed inserts and deletions (comments etc. are discarded) none: does nothing + + Critic marks only affects "github" and "markdown" (Python Markdown). */ "strip_critic_marks": "none", diff --git a/README.md b/README.md index d75db117..272ab8fe 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ You can use builtin [python-markdown][10] parser or use the [github markdown API - MathJax support : \\\\(\frac{\pi}{2}\\\\) thanks to @bps10 - HTML template customisation thanks to @hozaka - Embed images as base64 (see [settings][settings] file for more info) - - Strip out multimarkdown critic marks (see [settings][settings] file for more info) + - Strip out multimarkdown critic marks from either Githubs or Python Markdown input source (see [settings][settings] file for more info) - 3rd party extensions for the Python Markdown parser: | Extension | Documentation | From ba13440619b62999828ba7699389f8b6ff7b1fec Mon Sep 17 00:00:00 2001 From: facelessuser Date: Sat, 14 Nov 2015 09:13:09 -0700 Subject: [PATCH 06/12] Upgrade Markdown to 2.6.4 --- markdown/__version__.py | 2 +- markdown/blockprocessors.py | 27 ++++++++++------ markdown/extensions/footnotes.py | 4 ++- markdown/extensions/sane_lists.py | 12 ++++++-- markdown/extensions/smarty.py | 7 ++++- markdown/extensions/tables.py | 51 +++++++++++++++++++++++++++++-- markdown/inlinepatterns.py | 2 +- markdown/preprocessors.py | 7 +++-- 8 files changed, 92 insertions(+), 20 deletions(-) diff --git a/markdown/__version__.py b/markdown/__version__.py index 34425040..6830fc78 100644 --- a/markdown/__version__.py +++ b/markdown/__version__.py @@ -5,7 +5,7 @@ # (major, minor, micro, alpha/beta/rc/final, #) # (1, 1, 2, 'alpha', 0) => "1.1.2.dev" # (1, 2, 0, 'beta', 2) => "1.2b2" -version_info = (2, 6, 2, 'final', 0) +version_info = (2, 6, 4, 'final', 0) def _get_version(): diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py index 29db022c..870151be 100644 --- a/markdown/blockprocessors.py +++ b/markdown/blockprocessors.py @@ -38,7 +38,7 @@ def build_block_parser(md_instance, **kwargs): return parser -class BlockProcessor: +class BlockProcessor(object): """ Base class for block processors. Each subclass will provide the methods below to work with the source and @@ -141,7 +141,7 @@ class ListIndentProcessor(BlockProcessor): LIST_TYPES = ['ul', 'ol'] def __init__(self, *args): - BlockProcessor.__init__(self, *args) + super(ListIndentProcessor, self).__init__(*args) self.INDENT_RE = re.compile(r'^(([ ]{%s})+)' % self.tab_length) def test(self, parent, block): @@ -300,12 +300,6 @@ class OListProcessor(BlockProcessor): """ Process ordered list blocks. """ TAG = 'ol' - # Detect an item (``1. item``). ``group(1)`` contains contents of item. - RE = re.compile(r'^[ ]{0,3}\d+\.[ ]+(.*)') - # Detect items on secondary lines. they can be of either list type. - CHILD_RE = re.compile(r'^[ ]{0,3}((\d+\.)|[*+-])[ ]+(.*)') - # Detect indented (nested) items of either type - INDENT_RE = re.compile(r'^[ ]{4,7}((\d+\.)|[*+-])[ ]+.*') # The integer (python string) with which the lists starts (default=1) # Eg: If list is intialized as) # 3. Item @@ -314,6 +308,17 @@ class OListProcessor(BlockProcessor): # List of allowed sibling tags. SIBLING_TAGS = ['ol', 'ul'] + def __init__(self, parser): + super(OListProcessor, self).__init__(parser) + # Detect an item (``1. item``). ``group(1)`` contains contents of item. + self.RE = re.compile(r'^[ ]{0,%d}\d+\.[ ]+(.*)' % (self.tab_length - 1)) + # Detect items on secondary lines. they can be of either list type. + self.CHILD_RE = re.compile(r'^[ ]{0,%d}((\d+\.)|[*+-])[ ]+(.*)' % + (self.tab_length - 1)) + # Detect indented (nested) items of either type + self.INDENT_RE = re.compile(r'^[ ]{%d,%d}((\d+\.)|[*+-])[ ]+.*' % + (self.tab_length, self.tab_length * 2 - 1)) + def test(self, parent, block): return bool(self.RE.match(block)) @@ -407,7 +412,11 @@ class UListProcessor(OListProcessor): """ Process unordered list blocks. """ TAG = 'ul' - RE = re.compile(r'^[ ]{0,3}[*+-][ ]+(.*)') + + def __init__(self, parser): + super(UListProcessor, self).__init__(parser) + # Detect an item (``1. item``). ``group(1)`` contains contents of item. + self.RE = re.compile(r'^[ ]{0,%d}[*+-][ ]+(.*)' % (self.tab_length - 1)) class HashHeaderProcessor(BlockProcessor): diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py index d8caae27..b52815f3 100644 --- a/markdown/extensions/footnotes.py +++ b/markdown/extensions/footnotes.py @@ -96,7 +96,9 @@ def finder(element): if child.tail: if child.tail.find(self.getConfig("PLACE_MARKER")) > -1: return child, element, False - finder(child) + child_res = finder(child) + if child_res is not None: + return child_res return None res = finder(root) diff --git a/markdown/extensions/sane_lists.py b/markdown/extensions/sane_lists.py index 213c8a6f..828ae7ab 100644 --- a/markdown/extensions/sane_lists.py +++ b/markdown/extensions/sane_lists.py @@ -24,15 +24,23 @@ class SaneOListProcessor(OListProcessor): - CHILD_RE = re.compile(r'^[ ]{0,3}((\d+\.))[ ]+(.*)') SIBLING_TAGS = ['ol'] + def __init__(self, parser): + super(SaneOListProcessor, self).__init__(parser) + self.CHILD_RE = re.compile(r'^[ ]{0,%d}((\d+\.))[ ]+(.*)' % + (self.tab_length - 1)) + class SaneUListProcessor(UListProcessor): - CHILD_RE = re.compile(r'^[ ]{0,3}(([*+-]))[ ]+(.*)') SIBLING_TAGS = ['ul'] + def __init__(self, parser): + super(SaneUListProcessor, self).__init__(parser) + self.CHILD_RE = re.compile(r'^[ ]{0,%d}(([*+-]))[ ]+(.*)' % + (self.tab_length - 1)) + class SaneListExtension(Extension): """ Add sane lists to Markdown. """ diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py index 46e54c1e..600d74cd 100644 --- a/markdown/extensions/smarty.py +++ b/markdown/extensions/smarty.py @@ -83,7 +83,7 @@ from __future__ import unicode_literals from . import Extension -from ..inlinepatterns import HtmlPattern +from ..inlinepatterns import HtmlPattern, HTML_RE from ..odict import OrderedDict from ..treeprocessors import InlineProcessor @@ -147,6 +147,8 @@ remainingSingleQuotesRegex = "'" remainingDoubleQuotesRegex = '"' +HTML_STRICT_RE = HTML_RE + r'(?!\>)' + class SubstituteTextPattern(HtmlPattern): def __init__(self, pattern, replace, markdown_instance): @@ -251,6 +253,9 @@ def extendMarkdown(self, md, md_globals): self.educateQuotes(md) if configs['smart_angled_quotes']: self.educateAngledQuotes(md) + # Override HTML_RE from inlinepatterns.py so that it does not + # process tags with duplicate closing quotes. + md.inlinePatterns["html"] = HtmlPattern(HTML_STRICT_RE, md) if configs['smart_dashes']: self.educateDashes(md) inlineProcessor = InlineProcessor(md) diff --git a/markdown/extensions/tables.py b/markdown/extensions/tables.py index 368321d4..494aaeb3 100644 --- a/markdown/extensions/tables.py +++ b/markdown/extensions/tables.py @@ -19,6 +19,7 @@ from __future__ import unicode_literals from . import Extension from ..blockprocessors import BlockProcessor +from ..inlinepatterns import BacktickPattern, BACKTICK_RE from ..util import etree @@ -72,7 +73,11 @@ def _build_row(self, row, parent, align, border): for i, a in enumerate(align): c = etree.SubElement(tr, tag) try: - c.text = cells[i].strip() + if isinstance(cells[i], str) or isinstance(cells[i], unicode): + c.text = cells[i].strip() + else: + # we've already inserted a code element + c.append(cells[i]) except IndexError: # pragma: no cover c.text = "" if a: @@ -85,7 +90,49 @@ def _split_row(self, row, border): row = row[1:] if row.endswith('|'): row = row[:-1] - return row.split('|') + return self._split(row, '|') + + def _split(self, row, marker): + """ split a row of text with some code into a list of cells. """ + if self._row_has_unpaired_backticks(row): + # fallback on old behaviour + return row.split(marker) + # modify the backtick pattern to only match at the beginning of the search string + backtick_pattern = BacktickPattern('^' + BACKTICK_RE) + elements = [] + current = '' + i = 0 + while i < len(row): + letter = row[i] + if letter == marker: + if current != '' or len(elements) == 0: + # Don't append empty string unless it is the first element + # The border is already removed when we get the row, then the line is strip()'d + # If the first element is a marker, then we have an empty first cell + elements.append(current) + current = '' + else: + match = backtick_pattern.getCompiledRegExp().match(row[i:]) + if not match: + current += letter + else: + groups = match.groups() + delim = groups[1] # the code block delimeter (ie 1 or more backticks) + row_contents = groups[2] # the text contained inside the code block + i += match.start(4) # jump pointer to the beginning of the rest of the text (group #4) + element = delim + row_contents + delim # reinstert backticks + current += element + i += 1 + elements.append(current) + return elements + + def _row_has_unpaired_backticks(self, row): + count_total_backtick = row.count('`') + count_escaped_backtick = row.count('\`') + count_backtick = count_total_backtick - count_escaped_backtick + # odd number of backticks, + # we won't be able to build correct code blocks + return count_backtick & 1 class TableExtension(Extension): diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index ac79fcf0..200ea7c2 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -198,7 +198,7 @@ def __init__(self, pattern, markdown_instance=None): """ self.pattern = pattern - self.compiled_re = re.compile("^(.*?)%s(.*?)$" % pattern, + self.compiled_re = re.compile("^(.*?)%s(.*)$" % pattern, re.DOTALL | re.UNICODE) # Api for Markdown to pass safe_mode into instance diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py index 7fd38d33..7ea4fcf9 100644 --- a/markdown/preprocessors.py +++ b/markdown/preprocessors.py @@ -178,10 +178,11 @@ def _nested_markdown_in_html(self, items): else: # raw html if len(items) - right_listindex <= 1: # last element right_listindex -= 1 - offset = 1 if i == right_listindex else 0 + if right_listindex <= i: + right_listindex = i + 1 placeholder = self.markdown.htmlStash.store('\n\n'.join( - items[i:right_listindex + offset])) - del items[i:right_listindex + offset] + items[i:right_listindex])) + del items[i:right_listindex] items.insert(i, placeholder) return items From b652497b20efeb62cfb97bf0df66571bb10ba7a2 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Sat, 14 Nov 2015 17:42:37 -0700 Subject: [PATCH 07/12] Remove internal yaml and pygments and use dependencies - No one wants to hand upgrade these modules (especially pygments which requires knowing what special things to leave in during merge). So lets use the available dependencies. - With the removal of pygments, github themes need to be put in a CSS. Load them up and apply the appropriate selector. --- MarkdownPreview.py | 82 +- dependencies.json | 8 + lib/markdown_preview_lib/__init__.py | 0 lib/markdown_preview_lib/pygments/LICENSE | 25 - lib/markdown_preview_lib/pygments/__init__.py | 91 - lib/markdown_preview_lib/pygments/cmdline.py | 508 -- lib/markdown_preview_lib/pygments/console.py | 74 - lib/markdown_preview_lib/pygments/filter.py | 74 - .../pygments/filters/__init__.py | 350 -- .../pygments/formatter.py | 95 - .../pygments/formatters/__init__.py | 130 - .../pygments/formatters/_mapping.py | 76 - .../pygments/formatters/bbcode.py | 109 - .../pygments/formatters/html.py | 839 --- .../pygments/formatters/img.py | 560 -- .../pygments/formatters/latex.py | 476 -- .../pygments/formatters/other.py | 160 - .../pygments/formatters/rtf.py | 147 - .../pygments/formatters/svg.py | 153 - .../pygments/formatters/terminal.py | 151 - .../pygments/formatters/terminal256.py | 224 - lib/markdown_preview_lib/pygments/lexer.py | 870 --- .../pygments/lexers/__init__.py | 285 - .../pygments/lexers/_asy_builtins.py | 1645 ------ .../pygments/lexers/_cl_builtins.py | 232 - .../pygments/lexers/_cocoa_builtins.py | 73 - .../pygments/lexers/_lasso_builtins.py | 5182 ----------------- .../pygments/lexers/_lua_builtins.py | 250 - .../pygments/lexers/_mapping.py | 413 -- .../pygments/lexers/_mql_builtins.py | 1172 ---- .../pygments/lexers/_openedge_builtins.py | 2547 -------- .../pygments/lexers/_php_builtins.py | 4755 --------------- .../pygments/lexers/_postgres_builtins.py | 621 -- .../pygments/lexers/_scilab_builtins.py | 3094 ---------- .../pygments/lexers/_sourcemod_builtins.py | 1161 ---- .../pygments/lexers/_stan_builtins.py | 498 -- .../pygments/lexers/_vim_builtins.py | 1939 ------ .../pygments/lexers/actionscript.py | 240 - .../pygments/lexers/agile.py | 24 - .../pygments/lexers/algebra.py | 187 - .../pygments/lexers/ambient.py | 76 - .../pygments/lexers/apl.py | 101 - .../pygments/lexers/asm.py | 435 -- .../pygments/lexers/automation.py | 373 -- .../pygments/lexers/basic.py | 500 -- .../pygments/lexers/business.py | 592 -- .../pygments/lexers/c_cpp.py | 233 - .../pygments/lexers/c_like.py | 413 -- .../pygments/lexers/chapel.py | 98 - .../pygments/lexers/compiled.py | 33 - .../pygments/lexers/configs.py | 546 -- .../pygments/lexers/console.py | 114 - .../pygments/lexers/css.py | 498 -- lib/markdown_preview_lib/pygments/lexers/d.py | 251 - .../pygments/lexers/dalvik.py | 125 - .../pygments/lexers/data.py | 530 -- .../pygments/lexers/diff.py | 106 - .../pygments/lexers/dotnet.py | 690 --- .../pygments/lexers/dsls.py | 514 -- .../pygments/lexers/dylan.py | 289 - .../pygments/lexers/ecl.py | 125 - .../pygments/lexers/eiffel.py | 65 - .../pygments/lexers/erlang.py | 511 -- .../pygments/lexers/esoteric.py | 114 - .../pygments/lexers/factor.py | 344 -- .../pygments/lexers/fantom.py | 250 - .../pygments/lexers/felix.py | 273 - .../pygments/lexers/fortran.py | 161 - .../pygments/lexers/foxpro.py | 428 -- .../pygments/lexers/functional.py | 21 - .../pygments/lexers/go.py | 101 - .../pygments/lexers/graph.py | 79 - .../pygments/lexers/graphics.py | 553 -- .../pygments/lexers/haskell.py | 840 --- .../pygments/lexers/haxe.py | 936 --- .../pygments/lexers/hdl.py | 375 -- .../pygments/lexers/html.py | 589 -- .../pygments/lexers/idl.py | 262 - .../pygments/lexers/igor.py | 279 - .../pygments/lexers/inferno.py | 96 - .../pygments/lexers/installers.py | 322 - .../pygments/lexers/int_fiction.py | 1342 ----- .../pygments/lexers/iolang.py | 63 - .../pygments/lexers/javascript.py | 1199 ---- .../pygments/lexers/julia.py | 194 - .../pygments/lexers/jvm.py | 1560 ----- .../pygments/lexers/lisp.py | 1480 ----- .../pygments/lexers/make.py | 201 - .../pygments/lexers/markup.py | 501 -- .../pygments/lexers/math.py | 21 - .../pygments/lexers/matlab.py | 663 --- .../pygments/lexers/ml.py | 769 --- .../pygments/lexers/modeling.py | 356 -- .../pygments/lexers/nimrod.py | 159 - .../pygments/lexers/nit.py | 64 - .../pygments/lexers/nix.py | 136 - .../pygments/lexers/objective.py | 487 -- .../pygments/lexers/ooc.py | 85 - .../pygments/lexers/other.py | 40 - .../pygments/lexers/parsers.py | 835 --- .../pygments/lexers/pascal.py | 831 --- .../pygments/lexers/pawn.py | 199 - .../pygments/lexers/perl.py | 614 -- .../pygments/lexers/php.py | 245 - .../pygments/lexers/prolog.py | 306 - .../pygments/lexers/python.py | 833 --- lib/markdown_preview_lib/pygments/lexers/r.py | 453 -- .../pygments/lexers/rdf.py | 99 - .../pygments/lexers/rebol.py | 431 -- .../pygments/lexers/resource.py | 84 - .../pygments/lexers/robotframework.py | 560 -- .../pygments/lexers/ruby.py | 518 -- .../pygments/lexers/rust.py | 167 - .../pygments/lexers/scripting.py | 923 --- .../pygments/lexers/shell.py | 437 -- .../pygments/lexers/smalltalk.py | 195 - .../pygments/lexers/snobol.py | 83 - .../pygments/lexers/special.py | 100 - .../pygments/lexers/sql.py | 598 -- .../pygments/lexers/tcl.py | 145 - .../pygments/lexers/templates.py | 2174 ------- .../pygments/lexers/testing.py | 131 - .../pygments/lexers/text.py | 25 - .../pygments/lexers/textedit.py | 169 - .../pygments/lexers/textfmts.py | 292 - .../pygments/lexers/theorem.py | 466 -- .../pygments/lexers/urbi.py | 133 - .../pygments/lexers/web.py | 24 - .../pygments/lexers/webmisc.py | 920 --- lib/markdown_preview_lib/pygments/modeline.py | 40 - lib/markdown_preview_lib/pygments/plugin.py | 74 - lib/markdown_preview_lib/pygments/regexopt.py | 92 - lib/markdown_preview_lib/pygments/scanner.py | 104 - .../pygments/sphinxext.py | 155 - lib/markdown_preview_lib/pygments/style.py | 118 - .../pygments/styles/__init__.py | 80 - .../pygments/styles/autumn.py | 65 - .../pygments/styles/borland.py | 51 - .../pygments/styles/bw.py | 49 - .../pygments/styles/colorful.py | 81 - .../pygments/styles/default.py | 73 - .../pygments/styles/emacs.py | 72 - .../pygments/styles/friendly.py | 72 - .../pygments/styles/fruity.py | 42 - .../pygments/styles/github.py | 82 - .../pygments/styles/githubclassic.py | 82 - .../pygments/styles/igor.py | 29 - .../pygments/styles/manni.py | 75 - .../pygments/styles/monokai.py | 106 - .../pygments/styles/murphy.py | 80 - .../pygments/styles/native.py | 65 - .../pygments/styles/paraiso_dark.py | 125 - .../pygments/styles/paraiso_light.py | 125 - .../pygments/styles/pastie.py | 75 - .../pygments/styles/perldoc.py | 69 - .../pygments/styles/rrt.py | 33 - .../pygments/styles/tango.py | 141 - .../pygments/styles/tomorrow.py | 122 - .../pygments/styles/tomorrownight.py | 122 - .../pygments/styles/tomorrownightblue.py | 122 - .../pygments/styles/tomorrownightbright.py | 122 - .../pygments/styles/tomorrownighteighties.py | 122 - .../pygments/styles/trac.py | 63 - .../pygments/styles/vim.py | 63 - .../pygments/styles/vs.py | 38 - .../pygments/styles/xcode.py | 51 - lib/markdown_preview_lib/pygments/token.py | 198 - .../pygments/unistring.py | 217 - lib/markdown_preview_lib/pygments/util.py | 377 -- markdown/extensions/codehilite.py | 27 +- markdown_wrapper.py | 14 - pygments_css/github.css | 63 + pygments_css/github2014.css | 64 + yaml/__init__.py | 9 - yaml/lib/LICENSE | 19 - yaml/lib/__init__.py | 315 - yaml/lib/composer.py | 139 - yaml/lib/constructor.py | 675 --- yaml/lib/cyaml.py | 85 - yaml/lib/dumper.py | 62 - yaml/lib/emitter.py | 1140 ---- yaml/lib/error.py | 75 - yaml/lib/events.py | 86 - yaml/lib/loader.py | 40 - yaml/lib/nodes.py | 49 - yaml/lib/parser.py | 589 -- yaml/lib/reader.py | 190 - yaml/lib/representer.py | 484 -- yaml/lib/resolver.py | 224 - yaml/lib/scanner.py | 1457 ----- yaml/lib/serializer.py | 111 - yaml/lib/tokens.py | 104 - yaml/lib3/LICENSE | 19 - yaml/lib3/__init__.py | 312 - yaml/lib3/composer.py | 139 - yaml/lib3/constructor.py | 686 --- yaml/lib3/cyaml.py | 85 - yaml/lib3/dumper.py | 62 - yaml/lib3/emitter.py | 1137 ---- yaml/lib3/error.py | 75 - yaml/lib3/events.py | 86 - yaml/lib3/loader.py | 40 - yaml/lib3/nodes.py | 49 - yaml/lib3/parser.py | 589 -- yaml/lib3/reader.py | 192 - yaml/lib3/representer.py | 374 -- yaml/lib3/resolver.py | 224 - yaml/lib3/scanner.py | 1448 ----- yaml/lib3/serializer.py | 111 - yaml/lib3/tokens.py | 104 - 210 files changed, 201 insertions(+), 80495 deletions(-) create mode 100644 dependencies.json delete mode 100644 lib/markdown_preview_lib/__init__.py delete mode 100755 lib/markdown_preview_lib/pygments/LICENSE delete mode 100755 lib/markdown_preview_lib/pygments/__init__.py delete mode 100755 lib/markdown_preview_lib/pygments/cmdline.py delete mode 100755 lib/markdown_preview_lib/pygments/console.py delete mode 100755 lib/markdown_preview_lib/pygments/filter.py delete mode 100755 lib/markdown_preview_lib/pygments/filters/__init__.py delete mode 100755 lib/markdown_preview_lib/pygments/formatter.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/__init__.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/_mapping.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/bbcode.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/html.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/img.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/latex.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/other.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/rtf.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/svg.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/terminal.py delete mode 100755 lib/markdown_preview_lib/pygments/formatters/terminal256.py delete mode 100755 lib/markdown_preview_lib/pygments/lexer.py delete mode 100755 lib/markdown_preview_lib/pygments/lexers/__init__.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/_asy_builtins.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/_cl_builtins.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/_cocoa_builtins.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/_lasso_builtins.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/_lua_builtins.py delete mode 100755 lib/markdown_preview_lib/pygments/lexers/_mapping.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/_mql_builtins.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/_openedge_builtins.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/_php_builtins.py delete mode 100755 lib/markdown_preview_lib/pygments/lexers/_postgres_builtins.py delete mode 100755 lib/markdown_preview_lib/pygments/lexers/_scilab_builtins.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/_sourcemod_builtins.py delete mode 100755 lib/markdown_preview_lib/pygments/lexers/_stan_builtins.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/_vim_builtins.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/actionscript.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/agile.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/algebra.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/ambient.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/apl.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/asm.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/automation.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/basic.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/business.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/c_cpp.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/c_like.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/chapel.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/compiled.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/configs.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/console.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/css.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/d.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/dalvik.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/data.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/diff.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/dotnet.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/dsls.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/dylan.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/ecl.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/eiffel.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/erlang.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/esoteric.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/factor.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/fantom.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/felix.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/fortran.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/foxpro.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/functional.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/go.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/graph.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/graphics.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/haskell.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/haxe.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/hdl.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/html.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/idl.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/igor.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/inferno.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/installers.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/int_fiction.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/iolang.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/javascript.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/julia.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/jvm.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/lisp.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/make.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/markup.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/math.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/matlab.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/ml.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/modeling.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/nimrod.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/nit.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/nix.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/objective.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/ooc.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/other.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/parsers.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/pascal.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/pawn.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/perl.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/php.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/prolog.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/python.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/r.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/rdf.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/rebol.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/resource.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/robotframework.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/ruby.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/rust.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/scripting.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/shell.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/smalltalk.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/snobol.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/special.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/sql.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/tcl.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/templates.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/testing.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/text.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/textedit.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/textfmts.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/theorem.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/urbi.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/web.py delete mode 100644 lib/markdown_preview_lib/pygments/lexers/webmisc.py delete mode 100755 lib/markdown_preview_lib/pygments/modeline.py delete mode 100755 lib/markdown_preview_lib/pygments/plugin.py delete mode 100644 lib/markdown_preview_lib/pygments/regexopt.py delete mode 100755 lib/markdown_preview_lib/pygments/scanner.py delete mode 100755 lib/markdown_preview_lib/pygments/sphinxext.py delete mode 100755 lib/markdown_preview_lib/pygments/style.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/__init__.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/autumn.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/borland.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/bw.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/colorful.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/default.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/emacs.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/friendly.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/fruity.py delete mode 100644 lib/markdown_preview_lib/pygments/styles/github.py delete mode 100644 lib/markdown_preview_lib/pygments/styles/githubclassic.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/igor.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/manni.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/monokai.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/murphy.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/native.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/paraiso_dark.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/paraiso_light.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/pastie.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/perldoc.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/rrt.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/tango.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/tomorrow.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/tomorrownight.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/tomorrownightblue.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/tomorrownightbright.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/tomorrownighteighties.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/trac.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/vim.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/vs.py delete mode 100755 lib/markdown_preview_lib/pygments/styles/xcode.py delete mode 100755 lib/markdown_preview_lib/pygments/token.py delete mode 100755 lib/markdown_preview_lib/pygments/unistring.py delete mode 100755 lib/markdown_preview_lib/pygments/util.py create mode 100644 pygments_css/github.css create mode 100644 pygments_css/github2014.css delete mode 100644 yaml/__init__.py delete mode 100644 yaml/lib/LICENSE delete mode 100644 yaml/lib/__init__.py delete mode 100644 yaml/lib/composer.py delete mode 100644 yaml/lib/constructor.py delete mode 100644 yaml/lib/cyaml.py delete mode 100644 yaml/lib/dumper.py delete mode 100644 yaml/lib/emitter.py delete mode 100644 yaml/lib/error.py delete mode 100644 yaml/lib/events.py delete mode 100644 yaml/lib/loader.py delete mode 100644 yaml/lib/nodes.py delete mode 100644 yaml/lib/parser.py delete mode 100644 yaml/lib/reader.py delete mode 100644 yaml/lib/representer.py delete mode 100644 yaml/lib/resolver.py delete mode 100644 yaml/lib/scanner.py delete mode 100644 yaml/lib/serializer.py delete mode 100644 yaml/lib/tokens.py delete mode 100644 yaml/lib3/LICENSE delete mode 100644 yaml/lib3/__init__.py delete mode 100644 yaml/lib3/composer.py delete mode 100644 yaml/lib3/constructor.py delete mode 100644 yaml/lib3/cyaml.py delete mode 100644 yaml/lib3/dumper.py delete mode 100644 yaml/lib3/emitter.py delete mode 100644 yaml/lib3/error.py delete mode 100644 yaml/lib3/events.py delete mode 100644 yaml/lib3/loader.py delete mode 100644 yaml/lib3/nodes.py delete mode 100644 yaml/lib3/parser.py delete mode 100644 yaml/lib3/reader.py delete mode 100644 yaml/lib3/representer.py delete mode 100644 yaml/lib3/resolver.py delete mode 100644 yaml/lib3/scanner.py delete mode 100644 yaml/lib3/serializer.py delete mode 100644 yaml/lib3/tokens.py diff --git a/MarkdownPreview.py b/MarkdownPreview.py index c485b746..7de598c9 100644 --- a/MarkdownPreview.py +++ b/MarkdownPreview.py @@ -11,6 +11,12 @@ import time import codecs import cgi +import yaml + +pygments_local = { + 'github': 'pygments_css/github.css', + 'github2014': 'pygments_css/github2014.css' +} def is_ST3(): @@ -20,20 +26,14 @@ def is_ST3(): if is_ST3(): from . import desktop - from . import yaml from .markdown_settings import Settings from .markdown_wrapper import StMarkdown as Markdown - 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 from urllib.error import HTTPError, URLError from urllib.parse import quote from .markdown.extensions import codehilite - try: - PYGMENTS_AVAILABLE = codehilite.pygments - except: - PYGMENTS_AVAILABLE = False def Request(url, data, headers): ''' Adapter for urllib2 used in ST2 ''' @@ -44,22 +44,22 @@ def Request(url, data, headers): else: import desktop - import yaml from markdown_settings import Settings from markdown_wrapper import StMarkdown as Markdown - 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: - PYGMENTS_AVAILABLE = codehilite.pygments - except: - PYGMENTS_AVAILABLE = False unicode_str = unicode +from pygments.formatters import get_formatter_by_name +try: + PYGMENTS_AVAILABLE = codehilite.pygments +except: + PYGMENTS_AVAILABLE = False + _CANNOT_CONVERT = u'cannot convert markdown' PATH_EXCLUDE = tuple( @@ -119,7 +119,7 @@ def load_resource(name): if is_ST3(): return sublime.load_resource('Packages/Markdown Preview/{0}'.format(name)) else: - filename = os.path.join(sublime.packages_path(), INSTALLED_DIRECTORY, name) + filename = os.path.join(sublime.packages_path(), INSTALLED_DIRECTORY, os.path.normpath(name)) return load_utf8(filename) except: print("Error while load_resource('%s')" % name) @@ -974,14 +974,28 @@ def parser_specific_convert(self, markdown_text): class MarkdownCompiler(Compiler): default_css = "markdown.css" - def get_highlight(self): - ''' return the Pygments css if enabled ''' + def set_highlight(self, pygments_style, css_class): + ''' Set the Pygments css. ''' highlight = '' - if self.pygments_style and not self.noclasses: - highlight += '' % get_formatter_by_name('html', style=self.pygments_style).get_style_defs('.codehilite pre') + if pygments_style and not self.noclasses: + style = None + if pygments_style not in pygments_local: + try: + style = get_formatter_by_name('html', style=pygments_style).get_style_defs('.codehilite pre') + except Exception: + pygments_style = 'github' + if style is None: + style = load_resource(pygments_local[pygments_style]) % { + 'css_class': ''.join(['.' + x for x in css_class.split(' ') if x]) + } - return highlight + self.pygments_style = '' % style + return pygments_style + + def get_highlight(self): + ''' return the Pygments css if enabled. ''' + return self.pygments_style if self.pygments_style else '' def preprocessor_critic(self, text): ''' Stip out multi-markdown critic marks. Accept changes by default ''' @@ -993,24 +1007,29 @@ def parser_specific_preprocess(self, text): return text def process_extensions(self, extensions): - re_pygments = re.compile(r"pygments_style\s*=\s*([a-zA-Z][a-zA-Z_\d]*)") + re_pygments = re.compile(r"(?:\s*,)?pygments_style\s*=\s*([a-zA-Z][a-zA-Z_\d]*)") + re_pygments_replace = re.compile(r"pygments_style\s*=\s*([a-zA-Z][a-zA-Z_\d]*)") re_use_pygments = re.compile(r"use_pygments\s*=\s*(True|False)") re_insert_pygment = re.compile(r"(?Pcodehilite\([^)]+?)(?P\s*\)$)|(?Pcodehilite)") - re_no_classes = re.compile(r"noclasses\s*=\s*(True|False)") + re_no_classes = re.compile(r"(?:\s*,)?noclasses\s*=\s*(True|False)") + re_css_class = re.compile(r"css_class\s*=\s*([\w\-]+)") # First search if pygments has manually been set, # and if so, read what the desired color scheme to use is self.pygments_style = None self.noclasses = False use_pygments = True + pygments_css = None count = 0 for e in extensions: if e.startswith("codehilite"): m = re_use_pygments.search(e) use_pygments = True if m is None else m.group(1) == 'True' + m = re_css_class.search(e) + css_class = m.group(1) if m else 'codehilite' pygments_style = re_pygments.search(e) if pygments_style is None: - self.pygments_style = "github" + pygments_css = "github" m = re_insert_pygment.match(e) if m is not None: if m.group('bracket_start'): @@ -1020,9 +1039,20 @@ def process_extensions(self, extensions): start = m.group('start') + "(pygments_style=" end = ')' - extensions[count] = start + self.pygments_style + end + extensions[count] = start + pygments_css + end else: - self.pygments_style = pygments_style.group(1) + pygments_css = pygments_style.group(1) + + # Set the style, but update erase the setting if the CSS is pygments_local. + # Don't allow 'no_css' with non internal themes. + # Replace the setting with the correct name if the style was invalid. + original = pygments_css + pygments_css = self.set_highlight(pygments_css, css_class) + if pygments_css in pygments_local: + extensions[count] = re_no_classes.sub('', re_pygments.sub('', e)) + elif original != pygments_css: + extensions[count] = re_pygments_replace.sub('pygments_style=%s' % pygments_css, e) + noclasses = re_no_classes.search(e) if noclasses is not None and noclasses.group(1) == "True": self.noclasses = True @@ -1031,17 +1061,17 @@ def process_extensions(self, extensions): # Second, if nothing manual was set, see if "enable_highlight" is enabled with pygment support # If no style has been set, setup the default if ( - self.pygments_style is None and + pygments_css is None and self.settings.get("enable_highlight") is True ): + pygments_css = self.set_highlight('github', 'codehilite') guess_lang = str(bool(self.settings.get("guess_language", True))) use_pygments = bool(self.settings.get("enable_pygments", True)) extensions.append( - "codehilite(guess_lang=%s,pygments_style=github,use_pygments=%s)" % ( + "codehilite(guess_lang=%s,use_pygments=%s)" % ( guess_lang, str(use_pygments) ) ) - self.pygments_style = "github" if not use_pygments: self.pygments_style = None diff --git a/dependencies.json b/dependencies.json new file mode 100644 index 00000000..ef31286f --- /dev/null +++ b/dependencies.json @@ -0,0 +1,8 @@ +{ + "*": { + "*": [ + "pygments", + "pyyaml" + ] + } +} diff --git a/lib/markdown_preview_lib/__init__.py b/lib/markdown_preview_lib/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/markdown_preview_lib/pygments/LICENSE b/lib/markdown_preview_lib/pygments/LICENSE deleted file mode 100755 index 641c8e8e..00000000 --- a/lib/markdown_preview_lib/pygments/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2006-2014 by the respective authors (see AUTHORS file). -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/markdown_preview_lib/pygments/__init__.py b/lib/markdown_preview_lib/pygments/__init__.py deleted file mode 100755 index be6db19f..00000000 --- a/lib/markdown_preview_lib/pygments/__init__.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- -""" - Pygments - ~~~~~~~~ - - Pygments is a syntax highlighting package written in Python. - - It is a generic syntax highlighter for general use in all kinds of software - such as forum systems, wikis or other applications that need to prettify - source code. Highlights are: - - * a wide range of common languages and markup formats is supported - * special attention is paid to details, increasing quality by a fair amount - * support for new languages and formats are added easily - * a number of output formats, presently HTML, LaTeX, RTF, SVG, all image - formats that PIL supports, and ANSI sequences - * it is usable as a command-line tool and as a library - * ... and it highlights even Brainfuck! - - The `Pygments tip`_ is installable with ``easy_install Pygments==dev``. - - .. _Pygments tip: - http://bitbucket.org/birkenfeld/pygments-main/get/tip.zip#egg=Pygments-dev - - :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" -from __future__ import absolute_import - -__version__ = '2.0.1' -__docformat__ = 'restructuredtext' - -__all__ = ['lex', 'format', 'highlight'] - - -import sys -from .util import StringIO, BytesIO - - -def lex(code, lexer): - """ - Lex ``code`` with ``lexer`` and return an iterable of tokens. - """ - try: - return lexer.get_tokens(code) - except TypeError as err: - if isinstance(err.args[0], str) and \ - 'unbound method get_tokens' in err.args[0]: - raise TypeError('lex() argument must be a lexer instance, ' - 'not a class') - raise - - -def format(tokens, formatter, outfile=None): - """ - Format a tokenlist ``tokens`` with the formatter ``formatter``. - - If ``outfile`` is given and a valid file object (an object - with a ``write`` method), the result will be written to it, otherwise - it is returned as a string. - """ - try: - if not outfile: - #print formatter, 'using', formatter.encoding - realoutfile = formatter.encoding and BytesIO() or StringIO() - formatter.format(tokens, realoutfile) - return realoutfile.getvalue() - else: - formatter.format(tokens, outfile) - except TypeError as err: - if isinstance(err.args[0], str) and \ - 'unbound method format' in err.args[0]: - raise TypeError('format() argument must be a formatter instance, ' - 'not a class') - raise - - -def highlight(code, lexer, formatter, outfile=None): - """ - Lex ``code`` with ``lexer`` and format it with the formatter ``formatter``. - - If ``outfile`` is given and a valid file object (an object - with a ``write`` method), the result will be written to it, otherwise - it is returned as a string. - """ - return format(lex(code, lexer), formatter, outfile) - - -if __name__ == '__main__': - from .cmdline import main - sys.exit(main(sys.argv)) diff --git a/lib/markdown_preview_lib/pygments/cmdline.py b/lib/markdown_preview_lib/pygments/cmdline.py deleted file mode 100755 index d265e4a0..00000000 --- a/lib/markdown_preview_lib/pygments/cmdline.py +++ /dev/null @@ -1,508 +0,0 @@ -# -*- coding: utf-8 -*- -""" - pygments.cmdline - ~~~~~~~~~~~~~~~~ - - Command line interface. - - :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -from __future__ import print_function -from __future__ import absolute_import -import sys -import getopt -from textwrap import dedent - -from . import __version__, highlight -from .util import ClassNotFound, OptionError, docstring_headline -from .lexers import get_all_lexers, get_lexer_by_name, get_lexer_for_filename, \ - find_lexer_class, guess_lexer, TextLexer -from .formatters.latex import LatexEmbeddedLexer, LatexFormatter -from .formatters import get_all_formatters, get_formatter_by_name, \ - get_formatter_for_filename, find_formatter_class, \ - TerminalFormatter # pylint:disable-msg=E0611 -from .filters import get_all_filters, find_filter_class -from .styles import get_all_styles, get_style_by_name - - -USAGE = """\ -Usage: %s [-l | -g] [-F [:]] [-f ] - [-O ] [-P ] [-s] [-o ] [] - - %s -S - - -

%(title)s

- -''' - -DOC_HEADER_EXTERNALCSS = '''\ - - - - - %(title)s - - - - -

%(title)s

- -''' - -DOC_FOOTER = '''\ - - -''' - - -class HtmlFormatter(Formatter): - r""" - Format tokens as HTML 4 ```` tags within a ``
`` tag, wrapped
-    in a ``
`` tag. The ``
``'s CSS class can be set by the `cssclass` - option. - - If the `linenos` option is set to ``"table"``, the ``
`` is
-    additionally wrapped inside a ```` which has one row and two
-    cells: one containing the line numbers and one containing the code.
-    Example:
-
-    .. sourcecode:: html
-
-        
-
- - -
-
1
-            2
-
-
def foo(bar):
-              pass
-            
-
- - (whitespace added to improve clarity). - - Wrapping can be disabled using the `nowrap` option. - - A list of lines can be specified using the `hl_lines` option to make these - lines highlighted (as of Pygments 0.11). - - With the `full` option, a complete HTML 4 document is output, including - the style definitions inside a ``