You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
494 B
23 lines
494 B
const {parse, BOLD} = require("irc-caret-notation")
|
|
|
|
module.exports = class {
|
|
onCreate() {
|
|
this.state = {
|
|
paragraphs: [],
|
|
prev: "",
|
|
}
|
|
}
|
|
|
|
onInput(input) {
|
|
if (this.state == null) {
|
|
return
|
|
}
|
|
|
|
if (input.source != this.state.prev) {
|
|
this.state.prev = input.source
|
|
this.state.paragraphs = input.source.split("\n").filter(l => l.length > 0).map(l => parse(l, {
|
|
"*": (!(input.source.startsWith("(")) ? BOLD : null),
|
|
}))
|
|
}
|
|
}
|
|
}
|