| 896 | } |
| 897 | } |
| 898 | table(e) { |
| 899 | let t = this.rules.block.table.exec(e); |
| 900 | if (!t || !this.rules.other.tableDelimiter.test(t[2])) return; |
| 901 | let n = Y(t[1]), |
| 902 | s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), |
| 903 | i = t[3]?.trim() |
| 904 | ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(` |
| 905 | `) |
| 906 | : [], |
| 907 | r = { type: "table", raw: t[0], header: [], align: [], rows: [] }; |
| 908 | if (n.length === s.length) { |
| 909 | for (let o of s) |
| 910 | this.rules.other.tableAlignRight.test(o) |
| 911 | ? r.align.push("right") |
| 912 | : this.rules.other.tableAlignCenter.test(o) |
| 913 | ? r.align.push("center") |
| 914 | : this.rules.other.tableAlignLeft.test(o) |
| 915 | ? r.align.push("left") |
| 916 | : r.align.push(null); |
| 917 | for (let o = 0; o < n.length; o++) |
| 918 | r.header.push({ |
| 919 | text: n[o], |
| 920 | tokens: this.lexer.inline(n[o]), |
| 921 | header: !0, |
| 922 | align: r.align[o], |
| 923 | }); |
| 924 | for (let o of i) |
| 925 | r.rows.push( |
| 926 | Y(o, r.header.length).map((a, c) => ({ |
| 927 | text: a, |
| 928 | tokens: this.lexer.inline(a), |
| 929 | header: !1, |
| 930 | align: r.align[c], |
| 931 | })), |
| 932 | ); |
| 933 | return r; |
| 934 | } |
| 935 | } |
| 936 | lheading(e) { |
| 937 | let t = this.rules.block.lheading.exec(e); |
| 938 | if (t) |