Files
element-web-patches/patches/files/greentext.patch

64 lines
1.6 KiB
Diff
Raw Normal View History

--- a/node_modules/commonmark/lib/render/html.js
+++ b/node_modules/commonmark/lib/render/html.js
@@ -168,14 +168,54 @@
function block_quote(node, entering) {
var attrs = this.attrs(node);
+
+ if (node.firstChild !== null) {
+ var w = node.walker(), e, m=node.firstChild
+
+ while (m.firstChild !== null) {
+ m = m.firstChild
+ }
+
+ while (m.type !== 'document') {
+ if (m.type == 'text' && m.literal[0] !== '>') {
+ m.literal = '>' + m.literal
+ }
+ m = m.parent
+ }
+
+ while (e = w.next()) {
+ const n = e.node
+
+ if (e.entering == false) {
+ continue
+ }
+
+ if (n.type == 'text') {
+ let o = n.parent
+
+ while (o.type !== 'document') {
+ if (o.type == 'block_quote') {
+ break
+ } else {
+ o = o.parent
+ }
+ }
+
+ if (o.type == 'block_quote' && (n.prev && n.prev.type == 'softbreak') && n.literal[0] !== '>') {
+ n.literal = '>' + n.literal
+ }
+ }
+ }
+ }
+
if (entering) {
- this.cr();
- this.tag("blockquote", attrs);
- this.cr();
+ this.tag('font', [...attrs, ['color', '#789922']]);
+
+ if (!node.firstChild) {
+ this.buffer += '<p>&gt;</p>'
+ }
} else {
- this.cr();
- this.tag("/blockquote");
- this.cr();
+ this.tag('/font');
}
}