MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / inlineNormal

Function inlineNormal

lib/web/CodeMirror/mode/markdown/markdown.js:414–642  ·  view source on GitHub ↗
(stream, state)

Source from the content-addressed store, hash-verified

412 }
413
414 function inlineNormal(stream, state) {
415 var style = state.text(stream, state);
416 if (typeof style !== 'undefined')
417 return style;
418
419 if (state.list) { // List marker (*, +, -, 1., etc)
420 state.list = null;
421 return getType(state);
422 }
423
424 if (state.taskList) {
425 var taskOpen = stream.match(taskListRE, true)[1] === " ";
426 if (taskOpen) state.taskOpen = true;
427 else state.taskClosed = true;
428 if (modeCfg.highlightFormatting) state.formatting = "task";
429 state.taskList = false;
430 return getType(state);
431 }
432
433 state.taskOpen = false;
434 state.taskClosed = false;
435
436 if (state.header && stream.match(/^#+$/, true)) {
437 if (modeCfg.highlightFormatting) state.formatting = "header";
438 return getType(state);
439 }
440
441 var ch = stream.next();
442
443 // Matches link titles present on next line
444 if (state.linkTitle) {
445 state.linkTitle = false;
446 var matchCh = ch;
447 if (ch === '(') {
448 matchCh = ')';
449 }
450 matchCh = (matchCh+'').replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
451 var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
452 if (stream.match(new RegExp(regex), true)) {
453 return tokenTypes.linkHref;
454 }
455 }
456
457 // If this block is changed, it may need to be updated in GFM mode
458 if (ch === '`') {
459 var previousFormatting = state.formatting;
460 if (modeCfg.highlightFormatting) state.formatting = "code";
461 stream.eatWhile('`');
462 var count = stream.current().length
463 if (state.code == 0 && (!state.quote || count == 1)) {
464 state.code = count
465 return getType(state)
466 } else if (count == state.code) { // Must be exact
467 var t = getType(state)
468 state.code = 0
469 return t
470 } else {
471 state.formatting = previousFormatting

Callers

nothing calls this directly

Calls 12

getTypeFunction · 0.85
switchBlockFunction · 0.85
replaceMethod · 0.80
eatWhileMethod · 0.80
currentMethod · 0.80
indexOfMethod · 0.80
backUpMethod · 0.80
eatMethod · 0.80
nextMethod · 0.65
matchMethod · 0.45
testMethod · 0.45
peekMethod · 0.45

Tested by

no test coverage detected