highlights.scm 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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_text) @_label
  36. (link_destination) @_url
  37. (#set! @_label url @_url))
  38. (image
  39. (image_description) @_label
  40. (link_destination) @_url
  41. (#set! @_label url @_url))
  42. ; Conceal image links
  43. (image
  44. [
  45. "!"
  46. "["
  47. "]"
  48. "("
  49. (link_destination)
  50. ")"
  51. ] @markup.link
  52. (#set! conceal ""))
  53. ; Conceal full reference links
  54. (full_reference_link
  55. [
  56. "["
  57. "]"
  58. (link_label)
  59. ] @markup.link
  60. (#set! conceal ""))
  61. ; Conceal collapsed reference links
  62. (collapsed_reference_link
  63. [
  64. "["
  65. "]"
  66. ] @markup.link
  67. (#set! conceal ""))
  68. ; Conceal shortcut links
  69. (shortcut_link
  70. [
  71. "["
  72. "]"
  73. ] @markup.link
  74. (#set! conceal ""))
  75. [
  76. (link_destination)
  77. (uri_autolink)
  78. (email_autolink)
  79. ] @markup.link.url @nospell
  80. ((link_destination) @_url
  81. (#set! @_url url @_url))
  82. ((uri_autolink) @_url
  83. (#offset! @_url 0 1 0 -1)
  84. (#set! @_url url @_url))
  85. (entity_reference) @nospell
  86. ; Replace common HTML entities.
  87. ((entity_reference) @character.special
  88. (#eq? @character.special " ")
  89. (#set! conceal " "))
  90. ((entity_reference) @character.special
  91. (#eq? @character.special "<")
  92. (#set! conceal "<"))
  93. ((entity_reference) @character.special
  94. (#eq? @character.special "&gt;")
  95. (#set! conceal ">"))
  96. ((entity_reference) @character.special
  97. (#eq? @character.special "&amp;")
  98. (#set! conceal "&"))
  99. ((entity_reference) @character.special
  100. (#eq? @character.special "&quot;")
  101. (#set! conceal "\""))
  102. ((entity_reference) @character.special
  103. (#any-of? @character.special "&ensp;" "&emsp;")
  104. (#set! conceal " "))