diff --git a/apps/ssb.json b/apps/ssb.json index 79263a73..16ae2ce4 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🐌", - "previous": "&wuCG8/3Z93hPcX4PZNNoQnQx9L2QjCKfn/hoVHb2VJo=.sha256" + "previous": "&eapETfizGynW7oCLJmlsDwEYHqXWh2usHnDdVPxpXv0=.sha256" } diff --git a/apps/ssb/tf-message.js b/apps/ssb/tf-message.js index 998aaf41..731f0430 100644 --- a/apps/ssb/tf-message.js +++ b/apps/ssb/tf-message.js @@ -248,7 +248,7 @@ ${JSON.stringify(mention, null, 2)} Mentions ${mentions.map((x) => self.render_mention(x))} @@ -339,6 +339,9 @@ ${JSON.stringify(mention, null, 2)} ${this.message.messages.map( (x) => @@ -440,8 +443,8 @@ ${JSON.stringify(mention, null, 2)}`; } else if (this.message.placeholder) { return html`
${this.message.id} (placeholder) @@ -570,9 +573,6 @@ ${JSON.stringify(content, null, 2)}🔓` : undefined; - let style_background = this.message?.decrypted - ? 'background-color: rgba(255, 0, 0, 0.2)' - : 'backdrop-filter: brightness(1.2)'; return html`
@@ -616,9 +616,6 @@ ${JSON.stringify(content, null, 2)}🔓` : undefined; - let style_background = this.message?.decrypted - ? 'background: rgba(255, 0, 0, 0.2)' - : 'backdrop-filter: brightness(1.2)'; return html`
@@ -726,8 +723,8 @@ ${JSON.stringify(content, null, 2)}
diff --git a/apps/ssb/tf-styles.js b/apps/ssb/tf-styles.js index 7522007b..e29ba61c 100644 --- a/apps/ssb/tf-styles.js +++ b/apps/ssb/tf-styles.js @@ -34,12 +34,9 @@ const tf = css` content: ' ±'; } - code { - background-color: #444; - padding-left: 3px; - padding-right: 3px; - border: 1px dotted #fff; - border-radius: 4px; + pre code { + display: block; + padding: 8px; } blockquote { diff --git a/apps/ssb/tf-utils.js b/apps/ssb/tf-utils.js index 088d0b9b..e929d1ff 100644 --- a/apps/ssb/tf-utils.js +++ b/apps/ssb/tf-utils.js @@ -1,5 +1,7 @@ import * as hashtagify from './commonmark-hashtag.js'; +const k_code_classes = 'w3-theme-l4 w3-theme-border w3-round'; + function image(node, entering) { if ( node.firstChild?.type === 'text' && @@ -60,10 +62,20 @@ function image(node, entering) { } } +function code(node) { + let attrs = this.attrs(node); + attrs.push(['class', k_code_classes]); + this.tag('code', attrs); + this.out(node.literal); + this.tag('/code'); +} + function attrs(node) { let result = commonmark.HtmlRenderer.prototype.attrs.bind(this)(node); if (node.type == 'block_quote') { result.push(['class', 'w3-theme-d1']); + } else if (node.type == 'code_block') { + result.push(['class', k_code_classes]); } return result; } @@ -72,6 +84,7 @@ export function markdown(md) { let reader = new commonmark.Parser({safe: true}); let writer = new commonmark.HtmlRenderer(); writer.image = image; + writer.code = code; writer.attrs = attrs; let parsed = reader.parse(md || ''); parsed = hashtagify.transform(parsed);