diff --git a/.dictionary b/.dictionary index 868f7d26..1aec9616 100644 --- a/.dictionary +++ b/.dictionary @@ -20,6 +20,7 @@ MathJax MathJax's MultiMarkdown NONINFRINGEMENT +OAuth OSs Parsers PyMdown diff --git a/docs/src/markdown/_snippets/refs.md b/docs/src/markdown/_snippets/refs.md index d9e01a61..5865fa5a 100644 --- a/docs/src/markdown/_snippets/refs.md +++ b/docs/src/markdown/_snippets/refs.md @@ -17,4 +17,5 @@ [pymdownx]: http://facelessuser.github.io/pymdown-extensions/ [sequence]: https://bramp.github.io/js-sequence-diagrams/ [settings]: https://github.com/facelessuser/MarkdownPreview/blob/master/MarkdownPreview.sublime-settings +[superfences]: https://facelessuser.github.io/pymdown-extensions/extensions/superfences/ [toc]: https://pythonhosted.org/Markdown/extensions/toc.html#usage diff --git a/docs/src/markdown/changes.md b/docs/src/markdown/changes.md index ffd6b546..ccc42407 100644 --- a/docs/src/markdown/changes.md +++ b/docs/src/markdown/changes.md @@ -1,5 +1,9 @@ # Changes +## 2.1.2 + +- Don't allow live reload on save if using GitHub parser with no OAuth. + ## 2.1.1 - Revert `autoNumber` set to `all` in MathJax config. diff --git a/docs/src/markdown/usage.md b/docs/src/markdown/usage.md index 2d4054d1..92f5e2c0 100644 --- a/docs/src/markdown/usage.md +++ b/docs/src/markdown/usage.md @@ -74,7 +74,7 @@ To get live updates while editing a file after preview, you need to do the follo */ "enable_autoreload": true, ``` -2. Install [LiveReload][7] package from Package Control. +2. Install [LiveReload][live-reload] package from Package Control. 3. Restart. 4. Open the command palette and select the command `LiveReload: Enable/disable plug-ins`. 5. Select `Simple Reload with delay (400ms)`. It is possible you can get away with `Simple Reload`, but some experience an issue where they are one rev behind when using `Simple Reload`. diff --git a/markdown_preview.py b/markdown_preview.py index 6948bbf3..affe657a 100644 --- a/markdown_preview.py +++ b/markdown_preview.py @@ -166,7 +166,9 @@ class MarkdownPreviewListener(sublime_plugin.EventListener): def on_post_save(self, view): """Handle auto-reload on save.""" settings = sublime.load_settings('MarkdownPreview.sublime-settings') - if settings.get('enable_autoreload', True): + github_auth_provided = settings.get('github_oauth_token') is not None + parser = view.settings().get('parser') + if settings.get('enable_autoreload', True) and (parser != 'github' or github_auth_provided): filetypes = settings.get('markdown_filetypes') file_name = view.file_name() if filetypes and file_name is not None and file_name.endswith(tuple(filetypes)): @@ -176,7 +178,7 @@ def on_post_save(self, view): # todo : check if browser still opened and reopen it if needed view.run_command('markdown_preview', { 'target': 'disk', - 'parser': view.settings().get('parser') + 'parser': parser }) sublime.status_message('Markdown preview file updated')