lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js in gollum-2.0.0 vs lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js in gollum-2.1.0
- old
+ new
@@ -30,11 +30,11 @@
search: /([^\n]+)([\n\s]*)/g,
replace: "_$1_$2"
},
'function-code' : {
- search: /(^[\n]+)([\n\s]*)/g,
+ search: /([^\n]+)([\n\s]*)/g,
replace: "`$1`$2"
},
'function-hr' : {
append: "\n***\n"
@@ -42,15 +42,26 @@
'function-ul' : {
search: /(.+)([\n]?)/g,
replace: "* $1$2"
},
-
- /* This looks silly but is completely valid Markdown */
+ /* based on rdoc.js */
'function-ol' : {
- search: /(.+)([\n]?)/g,
- replace: "1. $1$2"
+ exec: function( txt, selText, $field ) {
+ var count = 1;
+ // split into lines
+ var repText = '';
+ var lines = selText.split("\n");
+ var hasContent = /[\w]+/;
+ for ( var i = 0; i < lines.length; i++ ) {
+ if ( hasContent.test(lines[i]) ) {
+ repText += (i + 1).toString() + '. ' +
+ lines[i] + "\n";
+ }
+ }
+ $.GollumEditor.replaceSelection( repText );
+ }
},
'function-blockquote' : {
search: /(.+)([\n]?)/g,
replace: "> $1$2"
@@ -78,10 +89,11 @@
title: 'Insert Link',
fields: [
{
id: 'text',
name: 'Link Text',
- type: 'text'
+ type: 'text',
+ defaultValue: selText
},
{
id: 'href',
name: 'URL',
type: 'text'