MCPcopy Create free account
hub / github.com/witheve/Eve / handleDelim

Function handleDelim

src/commonmark.js:1345–1379  ·  view source on GitHub ↗
(cc, block)

Source from the content-addressed store, hash-verified

1343
1344// Handle a delimiter marker for emphasis or a quote.
1345var handleDelim = function(cc, block) {
1346 var res = this.scanDelims(cc);
1347 if (!res) {
1348 return false;
1349 }
1350 var numdelims = res.numdelims;
1351 var startpos = this.pos;
1352 var contents;
1353
1354 this.pos += numdelims;
1355 if (cc === C_SINGLEQUOTE) {
1356 contents = "\u2019";
1357 } else if (cc === C_DOUBLEQUOTE) {
1358 contents = "\u201C";
1359 } else {
1360 contents = this.subject.slice(startpos, this.pos);
1361 }
1362 var node = text(contents);
1363 block.appendChild(node);
1364
1365 // Add entry to stack for this opener
1366 this.delimiters = { cc: cc,
1367 numdelims: numdelims,
1368 node: node,
1369 previous: this.delimiters,
1370 next: null,
1371 can_open: res.can_open,
1372 can_close: res.can_close };
1373 if (this.delimiters.previous !== null) {
1374 this.delimiters.previous.next = this.delimiters;
1375 }
1376
1377 return true;
1378
1379};
1380
1381var removeDelimiter = function(delim) {
1382 if (delim.previous !== null) {

Callers

nothing calls this directly

Calls 1

textFunction · 0.85

Tested by

no test coverage detected