fix lint errors + cleanup
This commit is contained in:
parent
c232fb7dd5
commit
0123f4e5f3
8 changed files with 62 additions and 225 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import Parser from "web-tree-sitter";
|
||||
import Parser from 'web-tree-sitter';
|
||||
|
||||
let base = "/";
|
||||
let base = '/';
|
||||
export function setBase(path) {
|
||||
base = path;
|
||||
}
|
||||
|
|
@ -28,10 +28,5 @@ export function loadParser() {
|
|||
export async function parse(code) {
|
||||
const parser = await loadParser();
|
||||
// for some reason, the parser doesn't like new lines..
|
||||
return parser.parse(
|
||||
code
|
||||
.replaceAll("\n\n", "~~~~")
|
||||
.replaceAll("\n", "")
|
||||
.replaceAll("~~~~", "\n")
|
||||
);
|
||||
return parser.parse(code.replaceAll('\n\n', '~~~~').replaceAll('\n', '').replaceAll('~~~~', '\n'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue