Skip to content

Commit

Permalink
fix: Fix changelog links
Browse files Browse the repository at this point in the history
Now you can click the links inside the generated changelog view.
  • Loading branch information
equinusocio committed Aug 8, 2016
1 parent 0297271 commit 7fd8117
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions mt_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import sublime
import sublime_plugin
import webbrowser

STYLES = '''
.mdpopups {
Expand Down Expand Up @@ -42,24 +43,26 @@
'''

class MtChangesCommand(sublime_plugin.WindowCommand):
def on_navigate(self, href):
webbrowser.open_new_tab(href)

def run(self):
import mdpopups
text = sublime.load_resource('Packages/Material Theme/CHANGELOG.md')
view = self.window.new_file()
view.set_name('Material Theme Changelog')
view.settings().set('gutter', False)
html = '<div class="mt-config-changes">%s</div>' % mdpopups.md2html(view, text)
mdpopups.add_phantom(view, 'changelog', sublime.Region(0), html, sublime.LAYOUT_INLINE, css=STYLES)
view.set_read_only(True)
view.set_scratch(True)
def run(self):
import mdpopups
text = sublime.load_resource('Packages/Material Theme/CHANGELOG.md')
view = self.window.new_file()
view.set_name('Material Theme Changelog')
view.settings().set('gutter', False)
html = '<div class="mt-config-changes">%s</div>' % mdpopups.md2html(view, text)
mdpopups.add_phantom(view, 'changelog', sublime.Region(0), html, sublime.LAYOUT_INLINE, css=STYLES, on_navigate=self.on_navigate)
view.set_read_only(True)
view.set_scratch(True)

def is_enabled(self):
try:
import mdpopups
except Exception:
return False
def is_enabled(self):
try:
import mdpopups
except Exception:
return False

return (mdpopups.version() >= (1, 9, 0)) and (int(sublime.version()) >= 3119)
return (mdpopups.version() >= (1, 9, 0)) and (int(sublime.version()) >= 3119)

is_visible = is_enabled
is_visible = is_enabled

0 comments on commit 7fd8117

Please sign in to comment.