highlights.scm 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. ; From MDeiml/tree-sitter-markdown
  2. (code_span) @markup.raw @nospell
  3. (emphasis) @markup.italic
  4. (strong_emphasis) @markup.strong
  5. (strikethrough) @markup.strikethrough
  6. (shortcut_link
  7. (link_text) @nospell)
  8. [
  9. (backslash_escape)
  10. (hard_line_break)
  11. ] @string.escape
  12. ; Conceal codeblock and text style markers
  13. ([
  14. (code_span_delimiter)
  15. (emphasis_delimiter)
  16. ] @conceal
  17. (#set! conceal ""))
  18. ; Conceal inline links
  19. (inline_link
  20. [
  21. "["
  22. "]"
  23. "("
  24. (link_destination)
  25. ")"
  26. ] @markup.link
  27. (#set! conceal ""))
  28. [
  29. (link_label)
  30. (link_text)
  31. (link_title)
  32. (image_description)
  33. ] @markup.link.label
  34. ((inline_link
  35. (link_destination) @_url) @_label
  36. (#set! @_label url @_url))
  37. ((image
  38. (link_destination) @_url) @_label
  39. (#set! @_label url @_url))
  40. ; Conceal image links
  41. (image
  42. [
  43. "!"
  44. "["
  45. "]"
  46. "("
  47. (link_destination)
  48. ")"
  49. ] @markup.link
  50. (#set! conceal ""))
  51. ; Conceal full reference links
  52. (full_reference_link
  53. [
  54. "["
  55. "]"
  56. (link_label)
  57. ] @markup.link
  58. (#set! conceal ""))
  59. ; Conceal collapsed reference links
  60. (collapsed_reference_link
  61. [
  62. "["
  63. "]"
  64. ] @markup.link
  65. (#set! conceal ""))
  66. ; Conceal shortcut links
  67. (shortcut_link
  68. [
  69. "["
  70. "]"
  71. ] @markup.link
  72. (#set! conceal ""))
  73. [
  74. (link_destination)
  75. (uri_autolink)
  76. (email_autolink)
  77. ] @markup.link.url @nospell
  78. ((uri_autolink) @_url
  79. (#offset! @_url 0 1 0 -1)
  80. (#set! @_url url @_url))
  81. (entity_reference) @nospell
  82. ; Replace common HTML entities.
  83. ((entity_reference) @character.special
  84. (#eq? @character.special " ")
  85. (#set! conceal " "))
  86. ((entity_reference) @character.special
  87. (#eq? @character.special "<")
  88. (#set! conceal "<"))
  89. ((entity_reference) @character.special
  90. (#eq? @character.special "&gt;")
  91. (#set! conceal ">"))
  92. ((entity_reference) @character.special
  93. (#eq? @character.special "&amp;")
  94. (#set! conceal "&"))
  95. ((entity_reference) @character.special
  96. (#eq? @character.special "&quot;")
  97. (#set! conceal "\""))
  98. ((entity_reference) @character.special
  99. (#any-of? @character.special "&ensp;" "&emsp;")
  100. (#set! conceal " "))