--- 
name: Setext
fileTypes: 
- etx
- etx.txt
firstLineMatch: setext
scopeName: text.setext
repository: 
  underline: 
    name: markup.underline.setext
    captures: 
      "1": 
        name: punctuation.definition.underline.setext
      "2": 
        name: punctuation.definition.underline.setext
      "3": 
        name: punctuation.definition.underline.setext
      "4": 
        name: punctuation.definition.underline.setext
    match: \b(_)\w+(?<!_)(_)\b|\b(_).+(?<!_)(_)\b
  hotword: 
    name: meta.link.reference.setext
    captures: 
      "0": 
        name: constant.other.reference.link.setext
      "1": 
        name: punctuation.definition.reference.setext
    match: \b[-\w.]*\w(?<!_)(_)\b
  inline: 
    patterns: 
    - include: "#italic"
    - include: "#bold"
    - include: "#underline"
    - include: "#hotword"
    - include: "#link"
    - include: "#doc_separator"
  bold: 
    name: markup.bold.setext
    captures: 
      "1": 
        name: punctuation.definition.bold.setext
      "2": 
        name: punctuation.definition.bold.setext
    match: ([*]{2}).+?([*]{2})
  link: 
    captures: 
      "1": 
        name: punctuation.definition.link.setext
      "2": 
        name: markup.underline.link.setext
      "3": 
        name: punctuation.definition.link.setext
    match: (<)((?i:mailto|https?|ftp|news)://.*?)(>)
    comment: Not actually part of setext, added for Tidbits.
  doc_separator: 
    name: meta.separator.document.setext
    captures: 
      "1": 
        name: punctuation.definition.separator.setext
    match: \s*(\$\$)$\n?
  italic: 
    name: markup.italic.setext
    captures: 
      "1": 
        name: punctuation.definition.italic.setext
      "2": 
        name: punctuation.definition.italic.setext
    match: (~)\w+(~)
uuid: FB227CE6-DC4C-4632-BCA3-965AE0D8E419
patterns: 
- include: "#inline"
- name: meta.header.setext
  captures: 
    "1": 
      name: keyword.other.setext
    "2": 
      name: punctuation.separator.key-value.setext
    "3": 
      name: string.unquoted.setext
  match: ^(Subject|Date|From)(:) (.+)
- name: markup.heading.1.setext
  match: ^={3,}\s*$\n?
- name: markup.heading.2.setext
  match: ^-{3,}\s*$\n?
- name: markup.quote.setext
  captures: 
    "1": 
      name: punctuation.definition.quote.setext
  begin: ^(>)\s
  end: $
  patterns: 
  - include: "#inline"
- name: markup.other.bullet.setext
  captures: 
    "1": 
      name: punctuation.definition.bullet.setext
  begin: ^([*])\s
  end: $
  patterns: 
  - include: "#inline"
- name: markup.raw.setext
  endCaptures: 
    "0": 
      name: punctuation.definition.raw.end.setext
  begin: "`"
  beginCaptures: 
    "0": 
      name: punctuation.definition.raw.begin.setext
  end: "`"
- name: meta.note.def.setext
  captures: 
    "7": 
      name: punctuation.definition.string.end.setext
    "1": 
      name: punctuation.definition.note.setext
    "2": 
      name: constant.other.reference.note.setext
    "3": 
      name: punctuation.definition.reference.setext
    "4": 
      name: string.quoted.other.note.setext
    "5": 
      name: punctuation.definition.string.begin.setext
  match: ^(\.{2}) ((_)[-\w.]+) +((\()(.+(\))|.+))$
- name: meta.link.reference.def.setext
  captures: 
    "1": 
      name: punctuation.definition.reference.setext
    "2": 
      name: constant.other.reference.link.setext
    "3": 
      name: punctuation.definition.reference.setext
    "4": 
      name: markup.underline.link.setext
  match: ^(\.{2}) ((_)[-\w.]+) +(.{2,})$
- name: comment.line.double-dot.setext
  captures: 
    "1": 
      name: punctuation.definition.comment.setext
  match: ^(\.{2}) (?![.]).+$\n?
- name: comment.block.logical_end_of_text.setext
  captures: 
    "1": 
      name: punctuation.definition.comment.setext
  begin: ^(\.{2})$
  end: not(?<=possible)
keyEquivalent: ^~S
