Drash Markup Language, a VSCode plugin for [Drash's](https://drash.land/drash) [template engine](https://drash.land/drash/tutorials/template-engine)
Drash Markup Language (dml) provides new language support and a LSP for .dml
files. .dml
files are just like .html
files, but provide a better user experience when using Drash's templatee engine, by:
-
Highlighting template code and tags
-
Providing diagnostics for incorrect or invalid usage of the template code
-
Supports autocompletion and highlights for HTML by default
-
[Install the extnesion for VSCode](link to the plugin)
-
Enable HTML support
Create a .vscode/settings.json
:
{
"files.associations": {
"*.dml": "html"
}
}
- Create a Drash resource and server:
import { Drash } from "https://deno.land/x/drash@<lastest_version>/mod.ts";
class Resource extends Drash.Http.Resource {
static paths = ["/"];
public GET () {
this.response = this.response.render("/index.dml", {
username: "Drash Markup Language",
runtimes: ["Node", "Deno"]
});
return this.response
}
}
const server = new Drash.Http.Server({
resources: [Resource],
views_path: "./views",
template_engine: true
});
server.run({
hostname: "localhost",
port: 1337
});
- Create a
index.dml
file and start writing markup, using Drash's template engine syntax:
// views/index.dml
<body>
<p><% username %></p>
<ul>
<%
for (const runtime in runtimes) {
<li><% runtime %></li>
}
%>
</body>
- Highlighting template code and tags
SCREENSHOT/ANIMATION
- Providing diagnostics for incorrect or invalid usage of the template code
SCREENSHOT/ANIMATION
- Supports autocompletion and highlights for HTML by default
SCREENSHOT/ANIMATION
Include if your extension adds any VS Code settings through the contributes.configuration
extension point.
For example:
This extension contributes the following settings:
myExtension.enable
: enable/disable this extensionmyExtension.thing
: set toblah
to do something
- @SRNV - Rudy helped a lot on the Language Support side, answering any queries, helping solve problems found, and just getting it up andd running. Huge thanks.
- @crooske - Eric had the idea of creating a template engine, and to create full support for using it, such as turning it into a new language, and creating the idea of IDE extensions/plugins.