WebReflection / vscode-literally-html

Adds syntax highlighting for html inside of JavaScript and TypeScript tagged template strings
https://marketplace.visualstudio.com/items?itemName=webreflection.literally-html
MIT License
34 stars 6 forks source link

literally HTML


WARNING

This project is inferior and not maintained as much as htmx-literals is.

There is also leet-html as alternative or lit-html so please consider using these instead as I am not planning to spend time on this any time soon.


A library agnostic fork of vscode-lit-html which aim is to bring syntax highlighting and language support for HTML inside of any JavaScript and TypeScript tagged template strings.

❗Important: IntelliSense and language support requires VS Code 1.20+.

Example

hyper(document.body)`
  <div class=${model.class}>
    ${model.greetings} !!!
  </div>`;

render`
  <ul>
    ${items.map(
      item => html`<li>${item.value}</li>`
    )}
  </ul>`;

Usage

If simply installing through VS Code is not enough, maybe the following could help.

# within your project
npm install --save-dev literally-html

# create a jsconfig.json file with the following content
echo '{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-lit-html-plugin"
      }
    ]
  }
}' > jsconfig.json