aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js1
-rw-r--r--lib/render.js14
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/app.js b/lib/app.js
index 81f58f5..2483357 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -41,6 +41,7 @@ function App(sbot, config) {
img_base: conf.img_base || (base + 'image/'),
emoji_base: conf.emoji_base || (base + 'emoji/'),
encode_msgids: conf.encode_msgids == null ? true : Boolean(conf.encode_msgids),
+ codeInTextareas: conf.codeInTextareas,
}
sbot.get = memo({cache: lru(100)}, sbot.get)
diff --git a/lib/render.js b/lib/render.js
index ace346d..fd357a0 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -63,15 +63,15 @@ MdRenderer.prototype.mention = function (preceding, id) {
}
MdRenderer.prototype.code = function (code, lang, escaped) {
- if (void 'TODO: check a config option') {
+ if (this.render.opts.codeInTextareas) {
+ return h('div', h('textarea', {
+ cols: 80,
+ rows: u.rows(code),
+ innerHTML: escaped ? code : u.escapeHTML(code)
+ })).outerHTML
+ } else {
return marked.Renderer.prototype.code.call(this, code, lang, escaped)
}
- // render as a textarea for better line wrapping in dillo
- return h('textarea', {
- cols: 80,
- rows: u.rows(code),
- innerHTML: escaped ? code : u.escapeHTML(code)
- }).outerHTML
}
function lexerRenderEmoji(emoji) {