Skip to content

Commit 87d32ff

Browse files
committed
add yaml support
1 parent 4e43b96 commit 87d32ff

File tree

11 files changed

+91
-19
lines changed

11 files changed

+91
-19
lines changed

.vscode/launch.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
{
22
"version": "0.1.0",
33
"configurations": [
4+
45
{
56
"type": "extensionHost",
67
"request": "launch",
78
"name": "Launch Extension",
89
"runtimeExecutable": "${execPath}",
910
"args": [
1011
"--extensionDevelopmentPath=${workspaceFolder}"
11-
],
12-
"outFiles": [
13-
"${workspaceFolder}/out/**/*.js"
14-
],
15-
"preLaunchTask": "npm run build"
12+
]
1613
}
1714
]
1815
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
1111

1212
## [Realease]
1313

14+
### [v0.4.2]
15+
- Add yaml support
16+
- Fix typos.
17+
1418
### [v0.4.2]
1519
- Add sign pair snippets for highlighting block.
1620
- Fix some typos.

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Highlight string as SQL, HTML, CSS or JavaScript in most languages.
2222
## Usages
2323

2424
| Language | Sign pair | Snippets | Comment|
25-
| -------- | ----------------------------- | ----------------------------- |-|
25+
| -------- | ----------------------------- | ----------------------------- | -------|
2626
| SQL | `--sql`, `;` | - |
2727
| SQL | `--beginsql`, `--endsql` | `hsql`, `highlight-sql` |
2828
| SQL | `--begin-sql`, `--end-sql` | - |
@@ -31,6 +31,7 @@ Highlight string as SQL, HTML, CSS or JavaScript in most languages.
3131
| HTML | `<!--html-->`, `<!--!html-->` | `hhtml`, `highlight-html` |
3232
| CSS | `/*css*/`, `/*!css*/` | `hcss`, `highlight-css` |
3333
| JS | `//js`, `//!js` | `hjs`, `highlight-javascript` |
34+
| Yaml | `--- #yaml`, `#!yaml` | `hyaml`, `highlight-yaml` |
3435

3536
- SQL
3637
1. Insert sign pair `--sql` and `;` to highlight single SQL sequence.<br>
@@ -42,6 +43,8 @@ Highlight string as SQL, HTML, CSS or JavaScript in most languages.
4243
- HTML, CSS, JS
4344
- Insert sign pairs `<!--html-->` and `<!--!html-->`, `/*css*/` and `/*!css*/`, `//js` and `//!js` to highlight one and more HTML, CSS or JS suquences. Other comments can be added after *language name*.<br>
4445
![HTML with Sign](./docs/HTML_with_Sign.png)
46+
- Yaml
47+
- Insert sign pairs `--- #yaml` and `#!yaml` to highlight YAML suquences.
4548
- Other
4649
- Highlight Variables between `{` and `}` in *highlighted* string code for `SQL` and `HTML` string. The idea is for `python` and `shell`, but works for any language now.<br>
4750
![Variables](./docs/SQL_with_variable.png)
@@ -57,10 +60,13 @@ Highlight string as SQL, HTML, CSS or JavaScript in most languages.
5760

5861
## Release Notes
5962

60-
See [CHANGELOG.md](./CHANGELOG.md)
63+
### [v0.4.2]
64+
- support Yaml
65+
66+
Please see [CHANGELOG.md](./CHANGELOG.md) for more information.
6167

6268
## Issues
63-
If you have any suggestion or issue, please feel free to subbmit it at [Github Issues](https://github.com/iuyoy/highlight-string-code/issues) page.
69+
If you have any suggestion or issue, please feel free to submit it at [Github Issues](https://github.com/iuyoy/highlight-string-code/issues) page.
6470

6571
## References
6672

build/generateSnippets.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { embedded_languages } = require('./languages');
55

66
const generateSnippets = () => {
77
return embedded_languages.reduce((out, embedded_languages) => {
8-
out[`Highlisht ${embedded_languages.language}`] = {
8+
out[`Highlight ${embedded_languages.language}`] = {
99
"prefix": [
1010
`h${embedded_languages.attr}`,
1111
`highlight-${embedded_languages.language}`
@@ -31,7 +31,7 @@ exports.updateSnippets = () => {
3131
/*
3232
Snippet Template
3333
{
34-
"Highlisht js": {
34+
"Highlight js": {
3535
"prefix": [
3636
"hjs",
3737
"highlight-js"

build/languages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const embedded_languages = [
44
{attr:'css', name: 'css', language: 'css', identifiers: ['css', 'css.erb'], source: 'source.css', block_begin: '/* css */', block_end: '/* !css */' },
55
{attr:'sql', name: 'sql', language: 'sql', identifiers: ['sql', 'ddl', 'dml'], source: 'source.sql', block_begin: '-- beginsql', block_end: '-- endsql' },
66
{attr:'hql', name: 'hive-sql', language: 'hive-sql', identifiers: ['sql', 'hql', 'hiveql'], source: 'source.hive-sql', block_begin: '-- hive', block_end: '-- !hive' },
7+
{attr:'yaml', name: 'yaml', language: 'yaml', identifiers: ['yaml'], source: 'source.yaml', block_begin: '--- #yaml', block_end: '#!yaml' }
78
]
89

910
exports.embedded_languages = embedded_languages;
10-

docs/README_CN.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Highlight string as SQL, HTML, CSS or JavaScript in most languages.
3131
| HTML | `<!--html-->`, `<!--!html-->` | `hhtml`, `highlight-html` |
3232
| CSS | `/*css*/`, `/*!css*/` | `hcss`, `highlight-css` |
3333
| JS | `//js`, `//!js` | `hjs`, `highlight-javascript` |
34+
| Yaml | `--- #yaml`, `#!yaml` | `hyaml`, `highlight-yaml` |
3435

3536
- SQL
3637
1.`--sql``;` 中插入单条SQL语句。<br>
@@ -42,6 +43,8 @@ Highlight string as SQL, HTML, CSS or JavaScript in most languages.
4243
- HTML, CSS, JS
4344
- 出现在标志 `<!--html-->``<!--!html-->``/*css*/``/*!css*/` 以及 `//js``//!js` 中的代码会分别被高亮为 HTML、 CSS 或者 JS。其他注释可以出现在 *标志语言* 之后。<br>
4445
![HTML with Sign](./HTML_with_Sign.png)
46+
- Yaml
47+
- 出现在 `--- #yaml``#!yaml` 中的代码会被高亮为YAML。
4548
- 其他
4649
- 在嵌套语言是 `SQL``HTML` 的代码中,高亮 `{``}` 中出现的变量。本意是给 PYTHON 和 SHELL 用的,但是目前对所有的语言都生效。<br>
4750
![Variables](./SQL_with_variable.png)
@@ -56,7 +59,10 @@ Highlight string as SQL, HTML, CSS or JavaScript in most languages.
5659

5760
## 更新日志
5861

59-
[CHANGELOG.md](./CHANGELOG.md)
62+
### [v0.4.2]
63+
- 支持高亮 Yaml
64+
65+
更多信息请见 [CHANGELOG.md](./CHANGELOG.md)
6066

6167
## 疑问?
6268

docs/demo.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,14 @@
101101
AND `name` != '{banned}man'
102102
;
103103
""".format(banned='bat', day='2019-09-26')
104+
105+
# ANCHOR yaml test
106+
"""
107+
--- #yaml
108+
name: test
109+
values:
110+
- good
111+
- better
112+
# comment
113+
#!yaml
114+
"""

docs/demo.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,15 @@ FROM
104104
WHERE birth > "'${day}'"
105105
AND name != "'${banned}man'"
106106
;
107-
'
107+
'
108+
109+
# ANCHOR yaml test
110+
"
111+
--- #yaml
112+
name: test
113+
values:
114+
- good
115+
- better
116+
# comment
117+
# !yaml
118+
"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "highlight-string-code",
33
"displayName": "Highlight String Code",
44
"description": "Highlight string as SQL, HTML, CSS or JS in most languages. 高亮内嵌的SQL,HTML, CSS或者JS",
5-
"version": "0.4.2",
5+
"version": "0.4.3",
66
"publisher": "iuyoy",
77
"author": {
88
"name": "iuyoy"
@@ -29,6 +29,7 @@
2929
"html",
3030
"sql",
3131
"hive",
32+
"yaml",
3233
"highlight",
3334
"hightlight",
3435
"embedded language"

snippets/highlight-blocks.code-snippets

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Highlisht javascript": {
2+
"Highlight javascript": {
33
"prefix": [
44
"hjs",
55
"highlight-javascript"
@@ -11,7 +11,7 @@
1111
],
1212
"description": "Sign pair for highlighting javascript code."
1313
},
14-
"Highlisht html": {
14+
"Highlight html": {
1515
"prefix": [
1616
"hhtml",
1717
"highlight-html"
@@ -23,7 +23,7 @@
2323
],
2424
"description": "Sign pair for highlighting html code."
2525
},
26-
"Highlisht css": {
26+
"Highlight css": {
2727
"prefix": [
2828
"hcss",
2929
"highlight-css"
@@ -35,7 +35,7 @@
3535
],
3636
"description": "Sign pair for highlighting css code."
3737
},
38-
"Highlisht sql": {
38+
"Highlight sql": {
3939
"prefix": [
4040
"hsql",
4141
"highlight-sql"
@@ -47,7 +47,7 @@
4747
],
4848
"description": "Sign pair for highlighting sql code."
4949
},
50-
"Highlisht hive-sql": {
50+
"Highlight hive-sql": {
5151
"prefix": [
5252
"hhql",
5353
"highlight-hive-sql"
@@ -58,5 +58,17 @@
5858
"-- !hive"
5959
],
6060
"description": "Sign pair for highlighting hive-sql code."
61+
},
62+
"Highlight yaml": {
63+
"prefix": [
64+
"hyaml",
65+
"highlight-yaml"
66+
],
67+
"body": [
68+
"--- #yaml",
69+
"$0",
70+
"#!yaml"
71+
],
72+
"description": "Sign pair for highlighting yaml code."
6173
}
6274
}

0 commit comments

Comments
 (0)