Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added: GitHub styles to markdown previews.

  • Loading branch information...
commit 5498cfe6c32a751e3e0bc0c30e1ec3bccd265972 1 parent c1c3d3f
@gf3 gf3 authored
Showing with 166 additions and 1 deletion.
  1. +162 −0 .vim/ftplugin/mkd-preview.css
  2. +4 −1 .vim/ftplugin/mkd.vim
View
162 .vim/ftplugin/mkd-preview.css
@@ -0,0 +1,162 @@
+/*------------------------------------------------------------------------------
+ @group Wiki Styles
+------------------------------------------------------------------------------*/
+html {
+ background-color: #FFF;
+}
+
+body {
+ margin: 20px auto;
+ padding: 0.7em;
+ width: 900px;
+ border: 1px solid #E9E9E9;
+ background:#f8f8f8;
+ /* font-size: 62.5%;
+ * font-family: Helvetica !important; */
+ font: normal normal normal 13.34px/normal helvetica, arial, freesans, clean, sans-serif;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ border: 0 !important;
+}
+
+h1 {
+ font-size: 170% !important;
+ border-top: 4px solid #aaa !important;
+ padding-top: .5em !important;
+ margin-top: 1.5em !important;
+}
+
+ h1:first-child {
+ margin-top: 0 !important;
+ padding-top: .25em !important;
+ border-top: none !important;
+ }
+
+h2 {
+ font-size: 150% !important;
+ margin-top: 1.5em !important;
+ border-top: 4px solid #e0e0e0 !important;
+ padding-top: .5em !important;
+}
+
+h3 {
+ margin-top: 1em !important;
+}
+
+p {
+ margin: 1em 0 !important;
+ line-height: 1.5em !important;
+}
+
+ul {
+ margin: 1em 0 1em 2em !important;
+}
+
+ ul {
+ margin-top: 0 !important;
+ margin-bottom: 0 !important;
+ }
+
+ol {
+ margin: 1em 0 1em 2em !important;
+}
+
+ ol ol {
+ margin-top: 0 !important;
+ margin-bottom: 0 !important;
+ }
+
+ul ul,
+ul ol,
+ol ol,
+ol ul {
+ margin-top: 0 !important;
+ margin-bottom: 0 !important;
+}
+
+blockquote {
+ margin: 1em 0 !important;
+ border-left: 5px solid #ddd !important;
+ padding-left: .6em !important;
+ color: #555 !important;
+}
+
+dt {
+ font-weight: bold !important;
+ margin-left: 1em !important;
+}
+
+dd {
+ margin-left: 2em !important;
+ margin-bottom: 1em !important;
+}
+
+table {
+ margin: 1em 0 !important;
+}
+
+ table th {
+ border-bottom: 1px solid #bbb !important;
+ padding: .2em 1em !important;
+ }
+
+ table td {
+ border-bottom: 1px solid #ddd !important;
+ padding: .2em 1em !important;
+ }
+
+pre {
+ margin: 1em 0 !important;
+ font-size: 90% !important;
+ background-color: #f8f8ff !important;
+ border: 1px solid #dedede !important;
+ padding: .5em !important;
+ line-height: 1.5em !important;
+ color: #444 !important;
+ overflow: auto !important;
+}
+
+ pre code {
+ padding: 0 !important;
+ font-size: 100% !important;
+ background-color: #f8f8ff !important;
+ border: none !important;
+ }
+
+code {
+ font-size: 90% !important;
+ background-color: #f8f8ff !important;
+ color: #444 !important;
+ padding: 0 .2em !important;
+ border: 1px solid #dedede !important;
+}
+
+/* console */
+
+pre.console {
+ margin: 1em 0 !important;
+ font-size: 90% !important;
+ background-color: black !important;
+ padding: .5em !important;
+ line-height: 1.5em !important;
+ color: white !important;
+}
+
+ pre.console code {
+ padding: 0 !important;
+ font-size: 100% !important;
+ background-color: black !important;
+ border: none !important;
+ color: white !important;
+ }
+
+ pre.console span {
+ color: #888 !important;
+ }
+
+ pre.console span.command {
+ color: yellow !important;
+ }
+
+/* @end */
View
5 .vim/ftplugin/mkd.vim
@@ -1,6 +1,7 @@
" mkd.vim
"
" Inspired by textile.vim from Tim Harper (tim.theenchanter.com)
+" Heavily modified by Gianni Chiappetta (gf3.ca)
command! -nargs=0 MarkdownRenderFile call MarkdownRenderBufferToFile()
command! -nargs=0 MarkdownRenderTab call MarkdownRenderBufferToTab()
@@ -27,8 +28,10 @@ function! MarkdownRender(lines)
endfunction
function! MarkdownRenderFile(lines, filename)
+ " Assumed tpope's pathogen is installed.
+ let css = "<link rel=\"stylesheet\" media=\"screen\" href=\"" . pathogen#split(&rtp)[0] . "/ftplugin/mkd-preview.css\" />"
let html = MarkdownRender(getbufline(bufname("%"), 1, '$'))
- let html = "<html><head><title>" . bufname("%") . "</title><body>\n" . html . "\n</body></html>"
+ let html = "<!DOCTYPE html><html><head><title>" . bufname("%") . "</title>" . css . "</head><body>\n" . html . "\n</body></html>"
return writefile(split(html, "\n"), a:filename)
endfunction
Please sign in to comment.
Something went wrong with that request. Please try again.