Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add markdown highlighting for @docs @moduledocs and @typedocs #90

Merged
merged 3 commits into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

# [Unreleased]

### Added

- Added syntax highlighting for markdown in `@doc`, `@moduledoc` and `@typedoc` modules attributes. Thanks to @SteffenDE for suggesting the solution and @Terbium-135 for implementing it.

## [0.0.18]

### Fixed
Expand Down
111 changes: 100 additions & 11 deletions syntaxes/elixir.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,71 +20,160 @@
"name": "meta.module.elixir"
},
{
"begin": "@(module|type)?doc (~s)?\"\"\"",
"begin": "@(?:module|type)?doc (?:~s)?\"\"\"",
"comment": "@doc with interpolated heredocs",
"end": "\\s*\"\"\"",
"name": "comment.documentation.heredoc.elixir",
"name": "documentation.heredoc.elixir",
"beginCaptures": {
"0": {
"name": "comment"
}
},
"endCaptures": {
"0": {
"name": "comment"
}
},
"patterns": [
{
"include": "#interpolated_elixir"
},
{
"include": "#escaped_char"
},
{
"begin": ".*",
"while": "(^|\\G)(?!\\s*\"\"\"\\s*$)",
"patterns": [
{
"include": "text.html.markdown"
}
]
}
]
},
{
"begin": "@(module|type)?doc ~s'''",
"begin": "@(?:module|type)?doc ~s'''",
"comment": "@doc with interpolated single quoted heredocs",
"end": "\\s*'''",
"name": "comment.documentation.heredoc.elixir",
"name": "documentation.heredoc.elixir",
"beginCaptures": {
"0": {
"name": "comment"
}
},
"endCaptures": {
"0": {
"name": "comment"
}
},
"patterns": [
{
"include": "#interpolated_elixir"
},
{
"include": "#escaped_char"
},
{
"begin": ".*",
"while": "(^|\\G)(?!\\s*'''\\s*$)",
"patterns": [
{
"include": "text.html.markdown"
}
]
}
]
},
{
"begin": "@(module|type)?doc ~S\"\"\"",
"begin": "@(?:module|type)?doc ~S\"\"\"",
"comment": "@doc with heredocs is treated as documentation",
"end": "\\s*\"\"\"",
"name": "comment.documentation.heredoc.elixir",
"name": "documentation.heredoc.elixir",
"beginCaptures": {
"0": {
"name": "comment"
}
},
"endCaptures": {
"0": {
"name": "comment"
}
},
"patterns": [
{
"include": "#escaped_char"
},
{
"begin": ".*",
"while": "(^|\\G)(?!\\s*\"\"\"\\s*$)",
"patterns": [
{
"include": "text.html.markdown"
}
]
}
]
},
{
"begin": "@(module|type)?doc ~S'''",
"begin": "@(?:module|type)?doc ~S'''",
"comment": "@doc with heredocs is treated as documentation",
"end": "\\s*'''",
"name": "comment.documentation.heredoc.elixir",
"name": "documentation.heredoc.elixir",
"beginCaptures": {
"0": {
"name": "comment"
}
},
"endCaptures": {
"0": {
"name": "comment"
}
},
"patterns": [
{
"include": "#escaped_char"
},
{
"begin": ".*",
"while": "(^|\\G)(?!\\s*'''\\s*$)",
"patterns": [
{
"include": "text.html.markdown"
}
]
}
]
},
{
"comment": "@doc false is treated as documentation",
"match": "@(module|type)?doc false",
"match": "@(?:module|type)?doc false",
"name": "comment.documentation.false"
},
{
"begin": "@(module|type)?doc \"",
"begin": "@(?:module|type)?doc \"",
"comment": "@doc with string is treated as documentation",
"end": "\"",
"name": "comment.documentation.string",
"name": "documentation.string",
"beginCaptures": {
"0": {
"name": "comment"
}
},
"endCaptures": {
"0": {
"name": "comment"
}
},
"patterns": [
{
"include": "#interpolated_elixir"
},
{
"include": "#escaped_char"
},
{
"include": "text.html.markdown"
}
]
},
Expand Down
Loading