Browse Source

Added correction of Ctrl+Bs in log posts showing as ** due to markdown being particular about where the bolds should be.

master
Gisle Aune 6 years ago
parent
commit
06bf2b67a2
  1. 14
      marko/page/logs-content/components/post/component.js

14
marko/page/logs-content/components/post/component.js

@ -83,6 +83,20 @@ module.exports = class {
this.state.text = input.post.text.replace(/\x02/g, "**").replace(/\x1D/g, "*").replace(/\`/g, "\\`").trim(); this.state.text = input.post.text.replace(/\x02/g, "**").replace(/\x1D/g, "*").replace(/\`/g, "\\`").trim();
// Fix Ctrl-Bs
let left = false
this.state.text = this.state.text.replace(/\s*\*\*\s*/g, str => {
left = !left
if (left) {
return " **"
} else if (!left) {
return "** "
}
return str
})
if (this.state.text.startsWith("|")) { if (this.state.text.startsWith("|")) {
this.state.name = "" this.state.name = ""
this.state.text = this.state.text.slice(1).trim(); this.state.text = this.state.text.slice(1).trim();

Loading…
Cancel
Save