-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix `run:` highlighting * Add a visual tester * Add eslintignore * eslintignore can't be nested apparently
- Loading branch information
Chris Swenson
authored
Sep 28, 2023
1 parent
badb59f
commit 14ca96f
Showing
8 changed files
with
243 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
build/ | ||
packages/malloy-malloy-sql/src/grammar | ||
packages/malloy-malloy-sql/src/grammar | ||
packages/malloy-syntax-highlight/**/*.monarch.ts |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<html> | ||
<head> | ||
<style> | ||
body { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
.left { | ||
width: 50%; | ||
border: 1px solid #efefef; | ||
margin: 10px; | ||
border-radius: 10px; | ||
overflow: hidden; | ||
padding: 3px; | ||
} | ||
#input { | ||
width: 100%; | ||
height: 100%; | ||
border: none; | ||
resize: none; | ||
} | ||
#input:focus { | ||
border: none; | ||
outline: none; | ||
} | ||
.right { | ||
padding: 3px; | ||
width: 50%; | ||
border: 1px solid #efefef; | ||
margin: 10px; | ||
border-radius: 10px; | ||
} | ||
pre { | ||
white-space: pre-wrap; | ||
margin: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="left"><textarea id="input"> | ||
source: flights is duckdb.table('flights.parquet') extend { | ||
dimension: foo is 1 | ||
} | ||
</textarea></div> | ||
<div class="right"><div id="output"></div></div> | ||
<script src="https://unpkg.com/shiki"></script> | ||
<script> | ||
fetch("./malloy.tmGrammar.json").then(response => { | ||
const malloyGrammar = response.json(); | ||
const update = (el) => { | ||
shiki | ||
.getHighlighter({ | ||
theme: 'light-plus', | ||
langs: [ | ||
"sql", | ||
"json", | ||
{ | ||
id: "malloy", | ||
scopeName: "source.malloy", | ||
embeddedLangs: ["sql"], | ||
grammar: malloyGrammar, | ||
}, | ||
], | ||
}) | ||
.then(highlighter => { | ||
const code = highlighter.codeToHtml(el.value, { lang: 'malloy' }) | ||
document.getElementById('output').innerHTML = code | ||
}) | ||
} | ||
const inp = document.getElementById("input"); | ||
inp.addEventListener('input', (ev) => update(ev.target)); | ||
update(inp); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.