Skip to content

Commit

Permalink
Improve Markdown syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
chbk committed Feb 21, 2025
1 parent dff47a8 commit 9772a74
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
26 changes: 20 additions & 6 deletions crates/languages/src/markdown-inline/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
(emphasis) @emphasis
(strong_emphasis) @emphasis.strong
(code_span) @text.literal
(link_text) @link_text
(link_label) @link_text
(link_destination) @link_uri
(emphasis) @markup.emphasis
(strong_emphasis) @markup.emphasis.strong
(code_span) @markup.raw
(strikethrough) @markup.strikethrough

[
(inline_link)
(shortcut_link)
(collapsed_reference_link)
(full_reference_link)
(image)
] @markup.link

(inline_link ["(" ")"] @markup.link.url)
(image ["(" ")"] @markup.link.url)
[
(link_destination)
(uri_autolink)
(email_autolink)
] @markup.link.url
24 changes: 21 additions & 3 deletions crates/languages/src/markdown/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
[
(paragraph)
(indented_code_block)
(pipe_table)
] @text

[
(atx_heading)
(setext_heading)
] @title
(thematic_break)
] @markup.heading
(setext_heading (paragraph) @markup.heading)

[
(list_marker_plus)
(list_marker_minus)
(list_marker_star)
(list_marker_dot)
(list_marker_parenthesis)
] @punctuation.list_marker
(block_quote_marker)
] @punctuation.markup

(pipe_table_header "|" @punctuation.markup)
(pipe_table_row "|" @punctuation.markup)
(pipe_table_delimiter_row "|" @punctuation.markup)
(pipe_table_delimiter_cell "-" @punctuation.markup)

(fenced_code_block
(info_string
(language) @text.literal))
(language) @punctuation.markup.embedded))
(fenced_code_block_delimiter) @punctuation.markup.embedded

(link_reference_definition) @markup.link
(link_destination) @markup.link.url

0 comments on commit 9772a74

Please sign in to comment.