Extend data baking to cosmic_jotdown
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Isaac Mills 2024-04-19 23:07:35 -04:00
parent 6bd0994b82
commit fc946144b0
Signed by: fnmain
GPG key ID: B67D7410F33A0F61
34 changed files with 102 additions and 201 deletions

160
Cargo.lock generated
View file

@ -512,12 +512,6 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
[[package]]
name = "bit_field"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
[[package]]
name = "bitflags"
version = "1.3.2"
@ -851,15 +845,17 @@ dependencies = [
[[package]]
name = "cosmic-jotdown"
version = "0.1.0"
source = "git+https://git.nations.lol/fnmain/cosmic-jotdown#e555f2fa77b06a30a92142ff745406261839cd53"
source = "git+https://git.nations.lol/fnmain/cosmic-jotdown#baf0fe08ef784b0815ad6c7deb617f04993d8459"
dependencies = [
"cosmic-text",
"databake",
"emath",
"image",
"jotdown",
"log",
"nominals",
"rangemap",
"serde",
]
[[package]]
@ -903,37 +899,12 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
[[package]]
name = "crunchy"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "crypto-common"
version = "0.1.6"
@ -1181,12 +1152,6 @@ dependencies = [
"web-sys",
]
[[package]]
name = "either"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2"
[[package]]
name = "emath"
version = "0.27.2"
@ -1422,22 +1387,6 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "exr"
version = "1.72.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4"
dependencies = [
"bit_field",
"flume",
"half",
"lebe",
"miniz_oxide",
"rayon-core",
"smallvec",
"zune-inflate",
]
[[package]]
name = "fastrand"
version = "1.9.0"
@ -1472,15 +1421,6 @@ dependencies = [
"miniz_oxide",
]
[[package]]
name = "flume"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181"
dependencies = [
"spin",
]
[[package]]
name = "font-types"
version = "0.5.2"
@ -1648,16 +1588,6 @@ dependencies = [
"wasi",
]
[[package]]
name = "gif"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2"
dependencies = [
"color_quant",
"weezl",
]
[[package]]
name = "gl_generator"
version = "0.14.0"
@ -1765,16 +1695,6 @@ dependencies = [
"bitflags 2.5.0",
]
[[package]]
name = "half"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888"
dependencies = [
"cfg-if",
"crunchy",
]
[[package]]
name = "hashbrown"
version = "0.14.3"
@ -1863,13 +1783,9 @@ dependencies = [
"bytemuck",
"byteorder",
"color_quant",
"exr",
"gif",
"jpeg-decoder",
"num-traits",
"png",
"qoi",
"tiff",
]
[[package]]
@ -1947,9 +1863,6 @@ name = "jpeg-decoder"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"
dependencies = [
"rayon",
]
[[package]]
name = "js-sys"
@ -1986,12 +1899,6 @@ version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
[[package]]
name = "lebe"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
[[package]]
name = "libc"
version = "0.2.153"
@ -2578,15 +2485,6 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58"
[[package]]
name = "qoi"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"
dependencies = [
"bytemuck",
]
[[package]]
name = "quick-xml"
version = "0.31.0"
@ -2646,6 +2544,9 @@ name = "rangemap"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f60fcc7d6849342eff22c4350c8b9a989ee8ceabc4b481253e8946b9fe83d684"
dependencies = [
"serde",
]
[[package]]
name = "raw-window-handle"
@ -2659,26 +2560,6 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544"
[[package]]
name = "rayon"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
dependencies = [
"crossbeam-deque",
"crossbeam-utils",
]
[[package]]
name = "read-fonts"
version = "0.19.0"
@ -3012,9 +2893,6 @@ name = "spin"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
dependencies = [
"lock_api",
]
[[package]]
name = "spirv"
@ -3137,17 +3015,6 @@ dependencies = [
"syn 2.0.60",
]
[[package]]
name = "tiff"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e"
dependencies = [
"flate2",
"jpeg-decoder",
"weezl",
]
[[package]]
name = "tinyvec"
version = "1.6.0"
@ -3621,12 +3488,6 @@ dependencies = [
"rustls-pki-types",
]
[[package]]
name = "weezl"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]]
name = "wgpu"
version = "0.19.4"
@ -4261,15 +4122,6 @@ version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d"
[[package]]
name = "zune-inflate"
version = "0.2.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"
dependencies = [
"simd-adler32",
]
[[package]]
name = "zvariant"
version = "3.15.2"

View file

@ -20,7 +20,7 @@ egui-glyphon = { git = "https://git.nations.lol/fnmain/egui-glyphon" }
egui_extras = { version = "0.27.2", features = ["image", "http", "file"] }
encase = { version = "0.7.0", features = ["glam"] }
glam = "0.25.0"
image = { version = "0.24.9", features = ["jpeg", "png"], defaut-features = false }
image = { version = "0.24.9", features = ["jpeg", "png"], default-features = false }
keyframe = { version = "1.1.1", default-features = false }
log = "0.4"
rangemap = "1.5.1"
@ -55,6 +55,7 @@ opt-level = 2
databake = "0.1.7"
glob = "0.3.1"
jotdown = { git = "https://git.nations.lol/fnmain/jotdown", features = ["parser"] }
cosmic-jotdown = { git = "https://git.nations.lol/fnmain/cosmic-jotdown", features = ["databake"] }
# If you want to use the bleeding edge version of egui and eframe:
# egui = { git = "https://github.com/emilk/egui", branch = "master" }

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
assets/images/git.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

BIN
assets/images/grezi.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
assets/images/grezi_hi.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

BIN
assets/images/vscode.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
assets/images/vscode_hi.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 KiB

View file

@ -1,29 +1,28 @@
use std::{borrow::Cow, path::Path};
use cosmic_jotdown::JotdownItem;
use databake::Bake;
use jotdown::Event;
fn main() {
let out = std::env::var("OUT_DIR").unwrap();
let jots = glob::glob("src/*.jot").unwrap();
let jots = glob::glob("src/*.dj").unwrap();
for path in jots.map(|p| p.unwrap()) {
let file = std::fs::read_to_string(&path).unwrap();
let name = path.file_name().unwrap();
let mut jot = jotdown::Parser::new(&file).collect::<Vec<_>>();
jot.push(Event::Start(
jotdown::Container::Paragraph,
jotdown::Attributes(None),
));
jot.push(Event::Str("Click anywhere to return to home screen".into()));
jot.push(Event::End(jotdown::Container::Paragraph));
let jot = cosmic_jotdown::jotdown_into_buffers(jotdown::Parser::new(&file).chain([
Event::Start(jotdown::Container::Paragraph, jotdown::Attributes(None)),
Event::Str("Click anywhere to return to home screen".into()),
Event::End(jotdown::Container::Paragraph),
]))
.collect::<Vec<_>>();
std::fs::write(
Path::new(&out).join(name),
Cow::Owned::<'_, [Event<'_>]>(jot)
Cow::Owned::<'_, [JotdownItem<'_>]>(jot)
.bake(&Default::default())
.to_string(),
)

View file

@ -13,7 +13,7 @@ use std::sync::Arc;
#[cfg(target_arch = "wasm32")]
use arc_swap::ArcSwapAny;
use cosmic_jotdown::Indent;
use cosmic_jotdown::{Indent, JotdownItem};
use eframe::egui::mutex::{Mutex, RwLock};
use eframe::egui::{
self, lerp, Align2, Id, Image, ImageSize, ImageSource, LayerId, OpenUrl, Pos2, Rect, Rounding,
@ -21,13 +21,13 @@ use eframe::egui::{
};
use eframe::egui_wgpu::{self, wgpu};
use egui::{Color32, Frame};
use egui_glyphon::glyphon::cosmic_text;
use egui_glyphon::glyphon::cosmic_text::{Align, BufferRef};
use egui_glyphon::glyphon::{self, Attrs, Color, Edit, Editor, Weight};
use egui_glyphon::{BufferWithTextArea, GlyphonRenderer, GlyphonRendererCallback};
use encase::ShaderType;
use glam::Mat2;
use glyphon::{Buffer, FontSystem, Metrics};
use jotdown::Event;
use keyframe::functions;
use rangemap::RangeMap;
use wgpu::util::DeviceExt;
@ -61,8 +61,9 @@ pub struct Portfolio {
#[cfg(target_arch = "wasm32")]
#[derive(Clone, Copy)]
pub enum State {
Start,
Home,
Context(Option<Mat2>, &'static Cow<'static, [Event<'static>]>),
Context(Option<Mat2>, &'static Cow<'static, [JotdownItem<'static>]>),
}
#[derive(Default)]
@ -75,33 +76,37 @@ pub struct ContextWindow {
pub struct ContextIcon {
pub icon: ImageSource<'static>,
pub content: &'static Cow<'static, [Event<'static>]>,
pub content: &'static Cow<'static, [JotdownItem<'static>]>,
pub angle_at: f32,
pub name: &'static str,
}
const CONTEXT_METRICS: Metrics = Metrics::new(16.0, 18.0);
const CONTEXT_METRICS: Metrics = Metrics::new(18.0, 20.0);
const HOVER_TIME: f64 = 0.5;
const ABOUT_ME: Cow<'static, [Event<'static>]> =
include!(concat!(env!("OUT_DIR"), "/about_me.jot"));
const INKSCAPE: Cow<'static, [Event<'static>]> =
include!(concat!(env!("OUT_DIR"), "/inkscape.jot"));
const RUST: Cow<'static, [Event<'static>]> = include!(concat!(env!("OUT_DIR"), "/rust.jot"));
const GIMP: Cow<'static, [Event<'static>]> = include!(concat!(env!("OUT_DIR"), "/gimp.jot"));
const REAPER: Cow<'static, [Event<'static>]> = include!(concat!(env!("OUT_DIR"), "/reaper.jot"));
const TREE_SITTER: Cow<'static, [Event<'static>]> =
include!(concat!(env!("OUT_DIR"), "/tree_sitter.jot"));
const LINUX: Cow<'static, [Event<'static>]> = include!(concat!(env!("OUT_DIR"), "/linux.jot"));
const PYTHON: Cow<'static, [Event<'static>]> = include!(concat!(env!("OUT_DIR"), "/python.jot"));
const KDENLIVE: Cow<'static, [Event<'static>]> =
include!(concat!(env!("OUT_DIR"), "/kdenlive.jot"));
const JAVA: Cow<'static, [Event<'static>]> = include!(concat!(env!("OUT_DIR"), "/java.jot"));
const SCRATCH: Cow<'static, [Event<'static>]> = include!(concat!(env!("OUT_DIR"), "/scratch.jot"));
const POSTGRESQL: Cow<'static, [Event<'static>]> =
include!(concat!(env!("OUT_DIR"), "/postgresql.jot"));
const ABOUT_ME: Cow<'static, [JotdownItem<'static>]> =
include!(concat!(env!("OUT_DIR"), "/about_me.dj"));
const INKSCAPE: Cow<'static, [JotdownItem<'static>]> =
include!(concat!(env!("OUT_DIR"), "/inkscape.dj"));
const RUST: Cow<'static, [JotdownItem<'static>]> = include!(concat!(env!("OUT_DIR"), "/rust.dj"));
const GIMP: Cow<'static, [JotdownItem<'static>]> = include!(concat!(env!("OUT_DIR"), "/gimp.dj"));
const REAPER: Cow<'static, [JotdownItem<'static>]> =
include!(concat!(env!("OUT_DIR"), "/reaper.dj"));
const TREE_SITTER: Cow<'static, [JotdownItem<'static>]> =
include!(concat!(env!("OUT_DIR"), "/tree_sitter.dj"));
const LINUX: Cow<'static, [JotdownItem<'static>]> = include!(concat!(env!("OUT_DIR"), "/linux.dj"));
const PYTHON: Cow<'static, [JotdownItem<'static>]> =
include!(concat!(env!("OUT_DIR"), "/python.dj"));
const KDENLIVE: Cow<'static, [JotdownItem<'static>]> =
include!(concat!(env!("OUT_DIR"), "/kdenlive.dj"));
const JAVA: Cow<'static, [JotdownItem<'static>]> = include!(concat!(env!("OUT_DIR"), "/java.dj"));
const SCRATCH: Cow<'static, [JotdownItem<'static>]> =
include!(concat!(env!("OUT_DIR"), "/scratch.dj"));
const POSTGRESQL: Cow<'static, [JotdownItem<'static>]> =
include!(concat!(env!("OUT_DIR"), "/postgresql.dj"));
const GIT: Cow<'static, [JotdownItem<'static>]> = include!(concat!(env!("OUT_DIR"), "/git.dj"));
const CONTEXT_ICONS: [ContextIcon; 11] = [
const CONTEXT_ICONS: [ContextIcon; 12] = [
ContextIcon {
#[cfg(target_arch = "wasm32")]
icon: ImageSource::Uri(Cow::Borrowed(concat!(
@ -213,6 +218,15 @@ const CONTEXT_ICONS: [ContextIcon; 11] = [
angle_at: -235.0,
name: "postgresql",
},
ContextIcon {
#[cfg(target_arch = "wasm32")]
icon: ImageSource::Uri(Cow::Borrowed(concat!(env!("PHOST"), "/images/git.png"))),
#[cfg(not(target_arch = "wasm32"))]
icon: ImageSource::Uri(Cow::Borrowed("file://assets/images/git.png")),
content: &GIT,
angle_at: -77.0,
name: "git",
},
];
const NAME_PLATE: [&str; 3] = [
@ -232,7 +246,7 @@ pub struct ResolvedItem<'a> {
impl ContextWindow {
pub fn set_content(
&mut self,
content: &'static Cow<'static, [Event<'static>]>,
content: &'static Cow<'static, [JotdownItem<'static>]>,
#[cfg(target_arch = "wasm32")] transform: Option<Mat2>,
#[cfg(target_arch = "wasm32")] name: Option<&'static str>,
font_system: &mut FontSystem,
@ -240,11 +254,9 @@ impl ContextWindow {
#[cfg(target_arch = "wasm32")] states: &mut Vec<State>,
) {
self.size = Vec2::new(max_width / 1.5, 0.0);
let text =
cosmic_jotdown::jotdown_into_buffers(content.iter().cloned()).collect::<Vec<_>>();
let (size, text) = cosmic_jotdown::resolve_paragraphs(
&text,
content.as_ref(),
self.size,
font_system,
CONTEXT_METRICS,
@ -361,6 +373,13 @@ impl Portfolio {
.set_onpopstate(Some(wasm_bindgen::JsCast::unchecked_ref(
popstate_closure.as_ref(),
)));
states.borrow_mut().push(State::Start);
web_sys::window()
.unwrap()
.history()
.unwrap()
.push_state(&wasm_bindgen::JsValue::from(0), "Home")
.unwrap();
}
egui_extras::install_image_loaders(&cc.egui_ctx);
@ -538,7 +557,7 @@ impl Portfolio {
fn update_state(&mut self, ui: &mut egui::Ui) {
if let Some(state) = self.next_state.load().deref() {
match state.deref() {
State::Home => {
State::Home | State::Start => {
self.zoomed = true;
self.click(ui, None, false);
}

12
src/git.dj Normal file
View file

@ -0,0 +1,12 @@
# Git (and related tooling) experience
I've been using git to do version control with my code since 2019 (which is when my [GitHub account](https://github.com/StratusFearMe21) was created).
![An image of my GitHub profile](images/github_profile.jpg#256x256)
Since learning GitHub I've also learned how to leverage git with programs like Woodpecker CI (See my [Linux experience](#linux)) which allow me to check and deploy code automatically.
- For a publication I was a founder of in highschool, [Compute](https://compute.nations.lol), I designed the infrastructure of the website to revolve around the git workflow (I also designed all the webpages on the site). See [this article](https://compute.nations.lol/master/how_to_run_a_journal.html) I wrote about the infrastructure behind the site.
![The home page of Compute](images/compute_home.jpg#256x256)
![An article written about Compute's infrastructure](images/compute_article.jpg#256x256)

View file

@ -6,10 +6,14 @@ For those who don't know, *Inkscape* is very similar to Adobe Illustrator, but o
![Political Ad Campaign](images/pac1.jpg#256x362)
- This project was for my Senior Web Development class, and the assignment was to make a logo for a fictional company using what knowledge of Adobe Illustrator (Inkscape) we had
- This project was for my Senior year Web Development class, and the assignment was to make a logo for a fictional company using what knowledge of Adobe Illustrator (Inkscape) we had
![Bitogo Corp logo and sologan](images/bitogo.jpg#256x362)
- This project was also for my Senior year Web Development class, the assignment was to make a mock business, and make various promotional items for them
![A business card for the mock business](images/business_card.jpg#256x146)
- This project was also for my Senior US Government class. It's a flag representing the mock country where the Angry Birds franchise takes place
![A mock flag for Bird Island](images/rovio.jpg#256x181)
@ -19,6 +23,3 @@ For those who don't know, *Inkscape* is very similar to Adobe Illustrator, but o
![Classic colorway](images/classic_scrappapercircus.jpg#256x256)
![Block colorway](images/block_scrappapercircus.jpg#256x256)
![Coptic colorway](images/coptic_scrappapercircus.jpg#256x256)

View file

@ -1,11 +1,11 @@
#![warn(clippy::all, rust_2018_idioms)]
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
use eframe::egui;
// When compiling natively:
#[cfg(not(target_arch = "wasm32"))]
fn main() -> eframe::Result<()> {
use eframe::egui;
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
let native_options = eframe::NativeOptions {

View file

@ -2,7 +2,7 @@
My language of choice is Rust. Everything I write on my own time, and everything I write if I can, I write it in Rust. Even this portfolio is written in Rust!
This portfolio uses these Rust crates:
This portfolio uses these Rust crates including but not limited to:
- `jotdown`
- `databake`
@ -12,3 +12,7 @@ This portfolio uses these Rust crates:
- `keyframe`
- `glam`
- `wgpu`
You can view the code for this portfolio [here](https://git.nations.lol/fnmain/portfolio)
![A screenshot of my GitHub projects I've worked on in Rust](images/rust_contribs.jpg#256x256)

14
src/tree_sitter.dj Normal file
View file

@ -0,0 +1,14 @@
# Tree-sitter (and other IDE tooling) Experience
[tree-sitter](https://tree-sitter.github.io/tree-sitter/) is a parser generator that takes a grammar written in JavaScript notation, and outputs a very fast parser written in C with incremental capabilities. Parsers generated by tree-sitter take source code and generate an abstract syntax tree which you can either walk manually, or get specific nodes out of using S-expressions.
Because of tree-sitter's incremental-parsing and tree-querying capabilites, making language servers for languages with a supported grammar is relatively trivial.
- This is a snippet of [grezi](https://github.com/StratusFearMe21/grezi-next) source code, a plain-text based slideshow program that I made that uses exclusively tree-sitter for parsing, syntax highlighting, and running a language server that provides inline annotations.
![A snippet of grezi source code](images/grezi.jpg#256x368)
- This is an instance of a language server I made, with a parser backed by tree-sitter, providing syntax highlighting, folding ranges, and a document outline for a [djot](https://djot.net) document in VSCode (VSCode doesn't normally support djot)
![A VSCode window with syntax highlighted djot source](images/vscode.jpg#256x256)

View file

@ -1 +0,0 @@
# Tree-sitter Experience