From 36826bd974e12f9838a44d28ab9f7dd498a2b166 Mon Sep 17 00:00:00 2001 From: Dairon Medina Caro <168440+codeadict@users.noreply.github.com> Date: Thu, 23 Jul 2026 13:17:29 -0400 Subject: [PATCH] Add EEP-59 Markdown injection support --- languages/erlang/config.toml | 2 +- languages/erlang/injections.scm | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/languages/erlang/config.toml b/languages/erlang/config.toml index 01eba93..9ffbc2e 100644 --- a/languages/erlang/config.toml +++ b/languages/erlang/config.toml @@ -2,7 +2,7 @@ name = "Erlang" grammar = "erlang" # TODO: support parsing rebar.config files # # https://github.com/WhatsApp/tree-sitter-erlang/issues/3 -path_suffixes = ["erl", "hrl", "app.src", "escript", "xrl", "yrl", "Emakefile", "rebar.config"] +path_suffixes = ["erl", "erlang", "hrl", "app.src", "escript", "xrl", "yrl", "Emakefile", "rebar.config"] line_comments = ["% ", "%% ", "%%% "] autoclose_before = ";:.,=}])>" brackets = [ diff --git a/languages/erlang/injections.scm b/languages/erlang/injections.scm index 2f0e58e..b5264d3 100644 --- a/languages/erlang/injections.scm +++ b/languages/erlang/injections.scm @@ -1,2 +1,19 @@ ((comment) @injection.content (#set! injection.language "comment")) + +; EEP-59 doc attributes use Markdown by default. +(wild_attribute + name: (attr_name + name: (atom) @_attribute) + value: (string) @injection.content + (#any-of? @_attribute "doc" "moduledoc") + (#set! injection.language "markdown")) + +; Also support the accepted parenthesized attribute form. +(wild_attribute + name: (attr_name + name: (atom) @_attribute) + value: (paren_expr + expr: (string) @injection.content) + (#any-of? @_attribute "doc" "moduledoc") + (#set! injection.language "markdown"))