This commit is contained in:
Henrique Dias 2015-09-18 21:46:25 +01:00
parent 92d7a5870c
commit d8c619dd3c
6 changed files with 44 additions and 7 deletions

View File

@ -39,6 +39,7 @@ module.exports = function(grunt) {
'node_modules/font-awesome/css/font-awesome.css',
'node_modules/animate.css/animate.min.css',
'node_modules/codemirror/lib/codemirror.css',
'node_modules/codemirror/theme/mdn-like.css',
'assets/css/src/main.css'
],
dest: 'assets/css/src/main.css',
@ -75,6 +76,7 @@ module.exports = function(grunt) {
'node_modules/jquery-pjax/jquery.pjax.js',
'node_modules/jquery-serializejson/jquery.serializejson.min.js',
'node_modules/codemirror/lib/codemirror.js',
'node_modules/codemirror/mode/markdown/markdown.js',
'node_modules/textarea-autosize/dist/jquery.textarea_autosize.js',
'assets/js/src/**/*.js'
]

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
box-sizing: border-box;
}
.editor.full .container {
.full .container {
position: fixed;
top : 3em;
right : 0;
@ -26,7 +26,8 @@
}
.editor #preview-area,
.editor textarea {
.editor textarea,
.CodeMirror {
position : relative;
box-sizing: border-box;
height : 100%;
@ -36,6 +37,10 @@
font-size : 1.05em;
}
.CodeMirror {
padding: 0;
}
.editor #preview-area *:first-child {
margin-top: 0;
}
@ -142,4 +147,10 @@
.full .action-bar {
width: 75%;
}
.full .cm-s-mdn-like.CodeMirror {
background: none;
width : auto;
margin : 1.5em 10%;
}

File diff suppressed because one or more lines are too long

View File

@ -43,6 +43,16 @@ $(document).on('ready pjax:success', function() {
return false;
});
if ($('#content-area')[0]) {
var myCodeMirror = CodeMirror.fromTextArea($('#content-area')[0], {
mode: 'markdown',
theme: 'mdn-like',
lineWrapping: true,
lineNumbers: false,
scrollbarStyle: null
});
}
// Submites any form in the page in JSON format
$('form').submit(function(event) {
event.preventDefault();

View File

@ -58,6 +58,20 @@ func Execute(w http.ResponseWriter, r *http.Request) (int, error) {
}
f, err := parser.InterfaceToFrontMatter(rawFile, mark)
fString := string(f)
// If it's toml or yaml, strip frontmatter identifier
if frontmatter == "toml" {
fString = strings.TrimSuffix(fString, "+++\n")
fString = strings.TrimPrefix(fString, "+++\n")
}
if frontmatter == "yaml" {
fString = strings.TrimSuffix(fString, "---\n")
fString = strings.TrimPrefix(fString, "---\n")
}
f = []byte(fString)
if err != nil {
log.Print(err)