MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / emStrong

Method emStrong

web/marked.min.js:1068–1121  ·  view source on GitHub ↗
(e, t, n = "")

Source from the content-addressed store, hash-verified

1066 }
1067 }
1068 emStrong(e, t, n = "") {
1069 let s = this.rules.inline.emStrongLDelim.exec(e);
1070 if (!s || (s[3] && n.match(this.rules.other.unicodeAlphaNumeric)))
1071 return;
1072 if (
1073 !(s[1] || s[2] || "") ||
1074 !n ||
1075 this.rules.inline.punctuation.exec(n)
1076 ) {
1077 let r = [...s[0]].length - 1,
1078 o,
1079 a,
1080 c = r,
1081 p = 0,
1082 u =
1083 s[0][0] === "*"
1084 ? this.rules.inline.emStrongRDelimAst
1085 : this.rules.inline.emStrongRDelimUnd;
1086 for (
1087 u.lastIndex = 0, t = t.slice(-1 * e.length + r);
1088 (s = u.exec(t)) != null;
1089 ) {
1090 if (((o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6]), !o))
1091 continue;
1092 if (((a = [...o].length), s[3] || s[4])) {
1093 c += a;
1094 continue;
1095 } else if ((s[5] || s[6]) && r % 3 && !((r + a) % 3)) {
1096 p += a;
1097 continue;
1098 }
1099 if (((c -= a), c > 0)) continue;
1100 a = Math.min(a, a + c + p);
1101 let d = [...s[0]][0].length,
1102 g = e.slice(0, r + s.index + d + a);
1103 if (Math.min(r, a) % 2) {
1104 let f = g.slice(1, -1);
1105 return {
1106 type: "em",
1107 raw: g,
1108 text: f,
1109 tokens: this.lexer.inlineTokens(f),
1110 };
1111 }
1112 let T = g.slice(2, -2);
1113 return {
1114 type: "strong",
1115 raw: g,
1116 text: T,
1117 tokens: this.lexer.inlineTokens(T),
1118 };
1119 }
1120 }
1121 }
1122 codespan(e) {
1123 let t = this.rules.inline.code.exec(e);
1124 if (t) {

Callers 1

inlineTokensMethod · 0.80

Calls 1

inlineTokensMethod · 0.80

Tested by

no test coverage detected