1
+ """Changelog."""
2
+ import sublime
3
+ import sublime_plugin
4
+ import mdpopups
5
+
6
+ CSS = '''
7
+ .mt-config-changes { {{'.background'|css}} margin: 0; padding: 0; }
8
+ .mt-config-changes ul li, .bracket-hightlighter p { {{'.foreground'|css}} }
9
+ .mt-config-changes a { color: #4B67FF; }
10
+ .mt-config-changes h1, .mt-config-changes h2, .mt-config-changes h3,
11
+ .mt-config-changes h4, .mt-config-changes h5, .mt-config-changes h6 {
12
+ {{'.string'|css('color')}}
13
+ }
14
+ .mt-config-changes h1, .mt-config-changes h2 { margin-top: 50px; }
15
+ .mt-config-changes h3, .mt-config-changes h4 { margin-top: 30px; }
16
+ .mt-config-changes blockquote { {{'.foreground'|css('color')}} }
17
+ '''
18
+
19
+
20
+ class MtChangesCommand (sublime_plugin .WindowCommand ):
21
+ """Changelog command."""
22
+
23
+ def run (self ):
24
+ """Show the changelog in a new view."""
25
+ text = sublime .load_resource ('Packages/Material Theme/CHANGELOG.md' )
26
+ view = self .window .new_file ()
27
+ view .set_name ('Material Theme - Changelog' )
28
+ view .settings ().set ('gutter' , False )
29
+ html = '<div class="mt-config-changes">%s</div>' % mdpopups .md2html (view , text )
30
+ mdpopups .add_phantom (view , 'changelog' , sublime .Region (0 ), html , sublime .LAYOUT_INLINE , css = CSS )
31
+ view .set_read_only (True )
32
+ view .set_scratch (True )
33
+
34
+ def is_enabled (self ):
35
+ """Check if is enabled."""
36
+ return (mdpopups .version () >= (1 , 7 , 3 )) and (int (sublime .version ()) >= 3118 )
37
+
38
+ is_visible = is_enabled
0 commit comments