Show More
@@ -226,16 +226,9 define([ | |||
|
226 | 226 | // make a markdown cell a heading |
|
227 | 227 | level = level || 1; |
|
228 | 228 | var source = this.get_text(); |
|
229 | // \s\S appears to be the js version of multi-line dot-all | |
|
230 | var match = source.match(/(#*)\s*([\s\S]*)/); | |
|
231 | // strip the leading `#` if it's already there | |
|
232 | if (match) { | |
|
233 | source = match[2]; | |
|
234 | } | |
|
235 | // add `#` markdown heading prefix | |
|
236 | var new_text = new Array(level + 1).join('#') + ' ' + source; | |
|
237 | ||
|
238 | this.set_text(new_text); | |
|
229 | source = source.replace(/^(#*)\s?/, | |
|
230 | new Array(level + 1).join('#') + ' '); | |
|
231 | this.set_text(source); | |
|
239 | 232 | this.refresh(); |
|
240 | 233 | if (this.rendered) { |
|
241 | 234 | this.render(); |
General Comments 0
You need to be logged in to leave comments.
Login now