-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a1bdd2b
Showing
30 changed files
with
5,449 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules/ |
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,17 @@ | ||
# note.rs | ||
|
||
Yet another note taking tool. | ||
|
||
## Run in dev mode | ||
|
||
```bash | ||
cargo tauri dev | ||
``` | ||
|
||
## References | ||
|
||
- [tauri](https://tauri.app/) | ||
- [vite](https://vitejs.dev/) | ||
- [npm](https://www.npmjs.com/) | ||
- [codemirror](https://codemirror.net/) | ||
- [marked](https://marked.js.org/) |
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,16 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="stylesheet" href="style.css" /> | ||
<title>note.rs</title> | ||
</head> | ||
<body> | ||
<div id="content"> | ||
<div id="editor"></div> | ||
<div id="view"></div> | ||
</div> | ||
|
||
<script type="module" src="/main.js"></script> | ||
</body> | ||
</html> |
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,25 @@ | ||
import { EditorView, basicSetup } from "codemirror" | ||
import { Compartment, Text } from "@codemirror/state" | ||
import { markdown } from "@codemirror/lang-markdown" | ||
import { marked } from "marked" | ||
|
||
const language = new Compartment(); | ||
const editor_element = document.querySelector("#editor"); | ||
const editor = new EditorView({ | ||
extensions: [ | ||
basicSetup, | ||
language.of(markdown()) | ||
], | ||
doc: "", | ||
parent: editor_element | ||
}); | ||
|
||
editor.dom.addEventListener('input', async () => { | ||
const text = editor.state.doc.toString(); | ||
const html = marked.parse(text, { | ||
pedantic: false, | ||
gfm: true | ||
}); | ||
document.querySelector("#view").innerHTML = html; | ||
}); | ||
|
Oops, something went wrong.