Skip to content

Commit

Permalink
feat: syntax highlighting for CSS in ES6 template literals
Browse files Browse the repository at this point in the history
  • Loading branch information
bashmish committed Aug 16, 2018
1 parent 215f54d commit f566f32
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 293 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
node_modules
/node_modules/
12 changes: 0 additions & 12 deletions .vscode/launch.json

This file was deleted.

1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/**
.vscode-test/**
.history/**
.gitignore
45 changes: 0 additions & 45 deletions CHANGELOG.md

This file was deleted.

2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
MIT License

Copyright (c) 2018 Mikhail Bashkirov

Copyright (c) 2018 Tobimori

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
73 changes: 9 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,82 +1,27 @@
# ES6 String HTML
> [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=Tobermory.es6-string-html)
# ES6 String CSS
> [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=bashmish.es6-string-css)
Adds syntax highlight support for code, placed in es6 multiline strings:
- HTML
- SQL
Adds syntax highlight support for code, placed in ES6 template literals:
- CSS

## Installation

- Install `es6-string-html` from extensions (`ctrl + shift + x`)
- Install `es6-string-css` from extensions (`ctrl + shift + x`)

## Example

![Example](docs/demo.png)

## Usage

Simply insert the comment /\*html\*/ or `html` (or sql instead of html) before the string
(see Requirements "section" for possible values) or select
`Insert es6-string-html comment/template` from the commands menu
(`ctrl+shift+p` or `f1`)
Simply insert `css` or the comment `/*css*/`, `/*inline-css*/` before a template literal.

> Tip: Comment in the beginning of es6 string is required
> Tip: Comment in the beginning of untagged template literal is required.
## Requirements

- Visual Studio Code v1.19.0 recommended
- Comment `/*html*/` before the string. Possible values:
- - `/*html*/`
- - `/*inline-html*/`
- - `/*template*/`
- - `/*inline-template*/`
- Or
- - `html` before the string

## Keybindings
- `ctrl+shift+h` - Insert `/*html*/`
- `ctrl+k h` - Insert `/*html*/` \`\`
## Credits

## Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=68P8BFSZPG5H2)

## Release Notes

### [1.0.0] - 2018-02-02
- Syntax highlighting for html in es6 multiline strings

### [1.1.0] - 2018-03-08
- Compatibility with Prettier

### [1.2.0] - 2018-03-12
- Commands and keybindings

### [1.3.0] - 2018-03-17
- Syntax highlight without a comment
- Follow semver

### [1.4.0] - 2018-03-22
- JS Syntax highlight
- Single-line comment support

### [1.5.0] - 2018-03-22
- Compatibility with Prettier

### [1.6.0] - 2018-08-13
- Add SQL support. Beta

### [1.6.0] - 2018-08-13
- Improve support for html function

### [1.7.0] - 2018-08-14
- Improve html function support

### [1.7.1] - 2018-08-15
- Improve single-line comments support
- Disable hotkeys
-----------------------------------------------------------------------------------------------------------

**Enjoy!**
This is a fork of the awesome extension [es6-string-html](https:/mydesireiscoma/es6-string-html/).
Binary file modified docs/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 15 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "es6-string-html",
"displayName": "es6-string-html",
"description": "Highlight different languages in es6 multiline strings",
"version": "1.7.1",
"publisher": "Tobermory",
"name": "es6-string-css",
"displayName": "es6-string-css",
"description": "Highlight CSS language in ES6 template literals",
"version": "0.0.0",
"publisher": "bashmish",
"icon": "docs/logo.png",
"engines": {
"vscode": "^1.19.0"
Expand All @@ -13,68 +13,34 @@
"theme": "light"
},
"repository": {
"url": "https:/mydesireiscoma/es6-string-html"
"url": "https:/bashmish/es6-string-css"
},
"bugs": {
"url": "https:/mydesireiscoma/es6-string-html/issues"
"url": "https:/bashmish/es6-string-css/issues"
},
"main": "./scripts/main",
"categories": [
"Languages"
"Programming Languages"
],
"keywords": [
"javascript",
"es6",
"es6-string-html",
"html",
"template"
],
"activationEvents": [
"onCommand:es6stringhtml.insertComment",
"onCommand:es6stringhtml.insertTemplate"
"css",
"lit-css",
"lit-html"
],
"contributes": {
"commands": [
{
"command": "es6stringhtml.insertComment",
"title": "Insert es6-string-html comment",
"category": "HTML"
},
{
"command": "es6stringhtml.insertTemplate",
"title": "Insert es6-string-html template",
"category": "HTML"
}
],
"grammars": [
{
"injectTo": [
"source.js",
"source.js.jsx",
"source.jsx",
"source.ts",
"source.tsx",
"text.html.basic"
],
"scopeName": "inline.es6-html",
"path": "./syntaxes/es6-inline-html.json",
"embeddedLanguages": {
"meta.embedded.block.html": "html"
}
},
{
"injectTo": [
"source.js",
"source.js.jsx",
"source.jsx",
"source.ts",
"source.tsx",
"source.sql"
"source.tsx"
],
"scopeName": "inline.es6-sql",
"path": "./syntaxes/es6-inline-sql.json",
"scopeName": "inline.es6-css",
"path": "./syntaxes/es6-inline-css.json",
"embeddedLanguages": {
"meta.embedded.sql": "sql"
"meta.embedded.block.css": "css"
}
}
]
Expand Down
36 changes: 0 additions & 36 deletions scripts/main.js

This file was deleted.

14 changes: 7 additions & 7 deletions syntaxes/es6-inline-sql.json → syntaxes/es6-inline-css.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"patterns": [
{
"begin": "(.?(sql))(`)",
"begin": "(.?(css))(`)",
"end": "(`)",
"beginCaptures": {
"1": {
Expand All @@ -30,12 +30,12 @@
"include": "source.ts#template-substitution-element"
},
{
"include": "source.sql"
"include": "source.css"
}
]
},
{
"begin": "(\\s?\\/?\\*?\\s?(sql|inline-sql)\\s?\\*?\\/?\\s?)(`)",
"begin": "(\\s?\\/?\\*?\\s?(css|inline-css)\\s?\\*?\\/?\\s?)(`)",
"beginCaptures": {
"1": {
"name": "comment.block"
Expand All @@ -47,12 +47,12 @@
"include": "source.ts#template-substitution-element"
},
{
"include": "source.sql"
"include": "source.css"
}
]
},
{
"begin": "(?<=\\=|\\:)\\s+(\\/\\/\\s?(sql|inline-sql)\\s?$)",
"begin": "(?<=\\=|\\:)\\s+(\\/\\/\\s?(css|inline-css)\\s?$)",
"beginCaptures": {
"1": {
"name": "comment.line"
Expand All @@ -68,10 +68,10 @@
"include": "source.ts#template-substitution-element"
},
{
"include": "source.sql"
"include": "source.css"
}
]
}
],
"scopeName": "inline.es6-sql"
"scopeName": "inline.es6-css"
}
Loading

0 comments on commit f566f32

Please sign in to comment.