Skip to content

Commit 133e08d

Browse files
azizkprincemaple
authored andcommitted
README: fixed code examples.
1 parent f2e3479 commit 133e08d

7 files changed

+170
-24
lines changed

README.md

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,48 @@
11
# ElixirSyntax
22

3-
ElixirSyntax was initially based on the [Elixir.tmbundle package](https://github.com/elixir-editors/elixir-tmbundle) but has been rewritten since, providing more accurate syntax matching as well as better syntax highlighting. Works with `goto definition`!
4-
5-
## Changes
6-
7-
See [CHANGELOG.md](./CHANGELOG.md) for the list of releases and noteworthy changes.
3+
ElixirSyntax was initially based on the [Elixir.tmbundle package](https://github.com/elixir-editors/elixir-tmbundle) but has been rewritten since, providing more accurate syntax matching as well as better syntax highlighting.
84

95
## Features
106

11-
Some of the provided features are not immediately evident. Among them are:
7+
* Working `Goto Definition` functionality
8+
* LiveView template highlighting: `~L"..."`\
9+
(Note: will be changed to the new HEEx syntax eventually.)
10+
* Full PCRE syntax highlighting: <img src="images/elixir_regex_example.svg" width="270" align="top">
11+
* Type highlighting: <img src="images/elixir_type_example.svg" width="620" align="top">
12+
13+
Some of the other provided features are not immediately evident. Among them are:
1214

1315
### The `fragment` and `sql` functions
1416

1517
SQL syntax is highlighted inside Ecto's `fragment` macro.
1618

17-
<blockquote><span class="mod">Post</span>
18-
<span class="kw">|></span> <span class="fnc">where</span>([post], <span class="fnc">fragment</span>(<span class="str_dlm">"</span><span class="prpl">?</span>.full_text <span class="kw">&lt;@</span> <span class="fnc">to_tsquery</span>(<span class="prpl">?</span>)<span class="str_dlm">"</span>, post, terms))
19+
<blockquote>
20+
<img src="images/elixir_fragment_example.svg" width="100%">
1921
</blockquote>
2022

2123
Add an `sql` macro/function to your project to enjoy SQL highlighting anywhere it's used.
2224

23-
<blockquote><span class="blu_i">defmacro</span> <span class="entity">sql</span>(<span class="param">sql</span>), <span class="akw">do</span><span class="colon">:</span> sql
24-
<span class="fnc">sql</span>(<span class="str_dlm">"</span><span class="kw">SELECT</span> <span class="param">*</span> <span class="kw">FROM</span> posts <span class="kw">ORDER</span> <span class="kw">BY</span> title <span class="kw">GROUP</span> <span class="kw">BY</span> user_id<span class="str_dlm">"</span>)
25+
<blockquote>
26+
<img src="images/elixir_sql_example.svg" width="100%">
2527
</blockquote>
2628

2729
### The JSON `~j` and `~J` sigils
2830

29-
Embed JSON strings in your Elixir code. (Notice the interpolated Elixir code is rendered properly.)
31+
Embed JSON strings in your Elixir code. Notice the interpolated Elixir code is colored correctly.
3032

31-
<blockquote><span class="blu_i">~j</span><span class="str_dlm">"""</span>
32-
{
33-
<span class="str_dlm">"</span><span class="str">key</span><span class="str_dlm">"</span>: <span class="str_dlm">"</span><span class="intp_dlm">#{</span><span class="intp_bg">value</span><span class="intp_dlm">}</span><span class="str_dlm">"</span>,
34-
<span class="str_dlm">"</span><span class="intp_dlm">#{</span><span class="intp_bg">key</span><span class="intp_dlm">}</span><span class="str_dlm">"</span>: <span class="str_dlm">"</span><span class="str">value</span><span class="str_dlm">"</span>
35-
}
36-
<span class="str_dlm">"""</span>
33+
<blockquote>
34+
<img src="images/elixir_json_example.svg" width="100%">
3735
</blockquote>
3836

3937
### The YAML `~y` and `~Y` sigils
4038

41-
<blockquote><span class="blu_i">~Y</span><span class="str_dlm">"""</span>
42-
<span class="kw">user</span>:
43-
<span class="kw">name</span>: <span class="str">YAML</span>
44-
<span class="kw">born</span>: <span class="prpl">2001</span><span class="prpl">-</span><span class="prpl">05</span><span class="prpl">-</span><span class="prpl">11</span>
45-
<span class="str_dlm">"""</span>
39+
<blockquote>
40+
<img src="images/elixir_yaml_example.svg" width="100%">
4641
</blockquote>
4742

48-
### Etc.
43+
## Changes
4944

50-
Also supported are LiveView (`~L"..."`) and the full PCRE syntax (`~r"..."`).
45+
See [CHANGELOG.md](./CHANGELOG.md) for the list of releases and noteworthy changes.
5146

5247
## Contributors/Maintainers
5348

images/elixir_fragment_example.svg

Lines changed: 24 additions & 0 deletions
Loading

images/elixir_json_example.svg

Lines changed: 28 additions & 0 deletions
Loading

images/elixir_regex_example.svg

Lines changed: 23 additions & 0 deletions
Loading

images/elixir_sql_example.svg

Lines changed: 24 additions & 0 deletions
Loading

images/elixir_type_example.svg

Lines changed: 25 additions & 0 deletions
Loading

images/elixir_yaml_example.svg

Lines changed: 27 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)