Skip to content
Browse files

github like css

  • Loading branch information...
1 parent 7186c2e commit b1f0bece880ac35888a01d19e045a819f22d95e6 @erinata committed Apr 3, 2012
Showing with 83 additions and 115 deletions.
  1. +24 −24 MarkdownBuild.py
  2. +59 −91 markdown.css
View
48 MarkdownBuild.py
@@ -1,29 +1,29 @@
-import sublime, sublime_plugin
+import sublime
+import sublime_plugin
import markdown_python
import os
import tempfile
+
class MarkdownBuild(sublime_plugin.WindowCommand):
- def run(self):
- view = self.window.active_view()
- if not view:
- return
- file_name = view.file_name()
- if not file_name:
- return
-
- contents = view.substr(sublime.Region(0, view.size()))
- md = markdown_python.markdown(contents)
- html = '<html><meta charset="UTF-8">'
- css = os.path.join(sublime.packages_path(), 'SublimeMarkdownBuild', 'markdown.css')
- if (os.path.isfile(css)):
- styles = open(css, 'r').read()
- html += '<style>' + styles + '</style>'
- html += "<body>"
- html += md
- html += "</body></html>"
- output = tempfile.NamedTemporaryFile(delete=False, suffix='.html')
- output.write(html.encode('UTF-8'))
- output.close()
- os.system(output.name)
-
+ def run(self):
+ view = self.window.active_view()
+ if not view:
+ return
+ file_name = view.file_name()
+ if not file_name:
+ return
+ contents = view.substr(sublime.Region(0, view.size()))
+ md = markdown_python.markdown(contents)
+ html = '<html><meta charset="UTF-8">'
+ css = os.path.join(sublime.packages_path(), 'SublimeMarkdownBuild', 'markdown.css')
+ if (os.path.isfile(css)):
+ styles = open(css, 'r').read()
+ html += '<style>' + styles + '</style>'
+ html += "<body>"
+ html += md
+ html += "</body></html>"
+ output = tempfile.NamedTemporaryFile(delete=False, suffix='.html')
+ output.write(html.encode('UTF-8'))
+ output.close()
+ os.system(output.name)
View
150 markdown.css
@@ -1,31 +1,65 @@
+html {
+ font-size: 100%;
+ overflow-y: scroll;
+ -webkit-text-size-adjust: 100%;
+ -ms-text-size-adjust: 100%;
+}
+
body{
- margin: 0 auto;
- font-family: Georgia, Palatino, serif;
- color: #444444;
- line-height: 1;
- max-width: 960px;
- padding: 30px;
- border-width: 2px;
- border-style: solid;
+ font-family: helvetica, arial, freesans, clean, sans-serif;
+ color: #333;
+ background-color: #fff;
border-color: #999999;
- background-color: #FFFFFF;
-}
-h1, h2, h3, h4 {
- color: #111111;
- font-weight: 400;
- background-color: #FFFFFF;
+ border-width: 2px;
+ line-height: 1.5;
+ margin: 2em 3em;
+ text-align:left;
+ padding: 0 350px 0 350px;
}
-h1, h2, h3, h4, h5, p {
- margin-bottom: 24px;
- padding: 0;
+
+pre{
+ background-color: #eee;
+ padding: 10px;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ overflow: auto;
+}
+code{
+ background-color: #eee;
+ padding: 1px 3px;
+ -webkit-border-radius: 2px;
+ -moz-border-radius: 2px;
+ border-radius: 2px;
+}
+li p{
+ margin: 0.3em;
+}
+li{
+ list-style-type: disc;
+}
+a:link, a:visited{
+ color: #33e;
+ text-decoration: none;
}
-h1 {
- font-size: 48px;
+a:hover{
+ color: #00f;
+ text-shadow:1px 1px 2px #ccf;
+ text-decoration:underline;
}
-h2 {
+h1{
+ color: #999;
+ font-weight: 400;
font-size: 36px;
}
-h3 {
+h2{
+ border-bottom: 1px dotted #aaa;
+ margin-bottom: 1em;
+ color: #333;
+ font-size: 30px;
+}
+h3{
+ color: #666;
font-size: 24px;
}
h4 {
@@ -34,74 +68,8 @@ h4 {
h5 {
font-size: 18px;
}
-a {
- color: #0099ff;
- margin: 0;
- padding: 0;
- vertical-align: baseline;
-}
-a:hover {
- text-decoration: none;
- color: #ff6600;
-}
-a:visited {
- color: #800080;
-}
-ul, ol {
- padding: 0;
- margin: 24px;
-}
-li {
- line-height: 24px;
-}
-li ul, li ul {
- margin-left: 24px;
-}
-p, ul, ol {
- font-size: 16px;
- line-height: 24px;
- max-width: 540px;
-}
-pre {
- padding: 0px 24px;
- max-width: 800px;
- white-space: pre-wrap;
- background-color: #FFEECC;
- padding: 0 4em;
-}
-code {
- font-family: Consolas, Monaco, Andale Mono, monospace;
- line-height: 1.5;
- font-size: 16px;
-
-}
-aside {
- display: block;
- float: right;
- width: 390px;
-}
-blockquote {
- border-left:.5em solid #eee;
- padding: 0 2em;
- margin-left:0;
- max-width: 476px;
-}
-blockquote cite {
- font-size:14px;
- line-height:20px;
- color:#bfbfbf;
-}
-blockquote cite:before {
- content: '\2014 \00A0';
-}
-
-blockquote p {
- color: #666;
- max-width: 460px;
-}
-hr {
- width: 540px;
- text-align: left;
- margin: 0 auto 0 0;
- color: #999;
+.shadow{
+ -webkit-box-shadow:0 5px 15px #000;
+ -moz-box-shadow:0 5px 15px #000;
+ box-shadow:0 5px 15px #000;
}

0 comments on commit b1f0bec

Please sign in to comment.
Something went wrong with that request. Please try again.