git ssb

6+

cel / downmark



Commit 05dd7e15223e6e4fac6742982803a59963334c48

Remove extra spaces after list item bullets

Charles Lehner committed on 6/3/2016, 12:41:50 AM
Parent: fabc115ec408aa86397386cdb395fb2f7ce3f297

Files changed

index.jschanged
index.jsView
@@ -18,10 +18,22 @@
1818 filter: ['span', 'div', 'small', 'font'],
1919 replacement: function (content) {
2020 return content
2121 }
22+ },
23+ {
24+ filter: 'li',
25+ replacement: function (content, node) {
26+ content = content.replace(/^\s+/, '').replace(/\n/gm, '\n ')
27+ var parent = node.parentNode
28+ var index = Array.prototype.indexOf.call(parent.children, node) + 1
29+
30+ var prefix = /ol/i.test(parent.nodeName) ? index + '. ' : '- '
31+ return prefix + content
32+ }
2233 }]
2334 }
35+
2436 inputEl.onkeydown = inputEl.onkeyup = debounce(function() {
2537 var newVal = inputEl.innerHTML
2638 if (value == newVal) return
2739 value = newVal

Built with git-ssb-web