# All files / src/lib/markdown-it/patches/custom-component inlineTags.js

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88

    10x

    10x

    /**
     * According to markdown spec, all non-block html tags are treated as "inline"
     * tags (wrapped with <p></p>), including those "unknown" tags
     *
     * Therefore, markdown-it processes "inline" tags and "unknown" tags in the same
     * way, and does not care if a tag is "inline" or "unknown"
     *
     * As we want to take those "unknown" tags as custom components, we should
     * treat them as "block" tags
     *
     * So we have to distinguish between "inline" and "unknown" tags ourselves
     *
     * The inline tags list comes from MDN
     *
     * @see https://spec.commonmark.org/0.29/#raw-html
     * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
     */
    const inlineTags = [
      // MODIFIED (MarkBind): added 'pic', 'thumbnail', 'popover', 'tooltip', 'trigger', and 'md' below
      'pic',
      'thumbnail',
      'popover',
      'tooltip',
      'trigger',
      'md',

      'a',
      'abbr',
      'acronym',
      'audio',
      'b',
      'bdi',
      'bdo',
      'big',
      'br',
      'button',
      'canvas',
      'cite',
      'code',
      'data',
      'datalist',
      'del',
      'dfn',
      'em',
      'embed',
      'i',
      /* iframe is treated as HTML blocks in markdown spec */
      // 'iframe',
      'img',
      'input',
      'ins',
      'kbd',
      'label',
      'map',
      'mark',
      'meta', // https://github.com/markdown-it/markdown-it/commit/ddbb195546d500649230a815828c67ecd1106099
      'meter',
      'noscript',
      'object',
      'output',
      'picture',
      'progress',
      'q',
      'ruby',
      's',
      'samp',
      'script',
      'select',
      'slot',
      'small',
      'span',
      'strong',
      'sub',
      'sup',
      'svg',
      'template',
      'textarea',
      'time',
      'u',
      'tt',
      'var',
      'video',
      'wbr',
    ];

    module.exports = inlineTags;