Description="GitHub Flavored Markdown"

Categories = {"markup", "two-pass"}

Keywords={
  { Id=1,
    Regex=[[^##?#?#?#?#?.+]],
  },
  { Id=2,
    Regex=[[(\[.+?\])\(http]],
  },
  { Id=3,
    Regex=[[\(http.+?\) ]],
  },
  --needs to be placed before kwd 4
  { Id=1,
    Regex=[[ ^\-{3,} ]],
  },
  { Id=1,
    Regex=[[ ^\={3,} ]],
  },
  { Id=4,
    Regex=[[ ^\s*(\-|\*|>) ]],
  },
}

Strings={
  Delimiter=[[```|`]]
}

IgnoreCase=false

--KeywordFormatHints={
--    {
    --Id=1,
    --Bold=true,
    --Italic=true,
    --Underline=true
--    }
--}

-- if highlight is called with --two-pass, this handler will save all lines
-- preceeding header lines as range with keyword ID 1
function OnStateChange(oldState, newState, token, kwgroup, lineNumber, column)
  if newState==HL_KEYWORD and kwgroup==1 and token[0]~='#' and lineNumber>1 then
    AddPersistentState(lineNumber-1, kwgroup, column, #token)
  end
end
