diff --git a/Cargo.toml b/Cargo.toml index c5f3ea0..c1dd45b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,6 @@ [workspace] resolver = "2" members = [ - ".", "./orgize", "./orgize-cli", "./orgize-common", diff --git a/README.md b/README.md index 5e7988d..ab3e4b0 100644 --- a/README.md +++ b/README.md @@ -1,71 +1,24 @@ # Orgize -[![Crates.io](https://img.shields.io/crates/v/orgize.svg)](https://crates.io/crates/orgize) -[![Documentation](https://docs.rs/orgize/badge.svg)](https://docs.rs/orgize) [![Build status](https://img.shields.io/github/actions/workflow/status/PoiScript/orgize/ci.yml)](https://github.com/PoiScript/orgize/actions/workflows/ci.yml) ![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg) -A Rust library for parsing org-mode files. +Org-mode toolkit written in Rust. -Live Demo: +This repository contains several crates/packages: -## Parse +| Crates/packages | Description | +| ----------------------------- | ------------------------------------------------------------- | +| [`orgize`] | A pure-rust library for parsing and exporting org-mode files. | +| [`orgize-cli`] | Common line utility for org-mode files, builtin with orgize. | +| [`orgize-lsp`] | Language server for org-mode files, builtin with orgize. | +| [`orgize-lsp/editors/vscode`] | [`orgize-lsp`] client for vscode editor | +| [`orgize-common`] | Shared code for [`orgize-cli`] and [`orgize-lsp`]. | +| [`orgize-wasm`] | WebAssembly module for Browser or Node.js environment. | -To parse a org-mode string, simply invoking the `Org::parse` function: - -```rust -use orgize::{Org, rowan::ast::AstNode}; - -let org = Org::parse("* DONE Title :tag:"); -assert_eq!( - format!("{:#?}", org.document().syntax()), - r#"DOCUMENT@0..18 - HEADLINE@0..18 - HEADLINE_STARS@0..1 "*" - WHITESPACE@1..2 " " - HEADLINE_KEYWORD_DONE@2..6 "DONE" - WHITESPACE@6..7 " " - HEADLINE_TITLE@7..13 - TEXT@7..13 "Title " - HEADLINE_TAGS@13..18 - COLON@13..14 ":" - TEXT@14..17 "tag" - COLON@17..18 ":" -"#); -``` - -use `ParseConfig::parse` to specific a custom parse config - -```rust -use orgize::{Org, ParseConfig, ast::Headline}; - -let config = ParseConfig { - // custom todo keywords - todo_keywords: (vec!["TASK".to_string()], vec![]), - ..Default::default() -}; -let org = config.parse("* TASK Title 1"); -let hdl = org.first_node::().unwrap(); -assert_eq!(hdl.todo_keyword().unwrap(), "TASK"); -``` - -## Render to html - -Call the `Org::to_html` function to export org element tree to html: - -```rust -use orgize::Org; - -assert_eq!( - Org::parse("* title\n*section*").to_html(), - "

title

section

" -); -``` - -Checkout `examples/html-slugify.rs` on how to customizing html export process. - -## Features - -- **`chrono`**: adds the ability to convert `Timestamp` into `chrono::NaiveDateTime`, disabled by default. - -- **`indexmap`**: adds the ability to convert `PropertyDrawer` properties into `IndexMap`, disabled by default. +[`orgize`]: ./orgize +[`orgize-cli`]: ./orgize-cli +[`orgize-lsp`]: ./orgize-lsp +[`orgize-lsp/editors/vscode`]: ./orgize-lsp/editors/vscode +[`orgize-common`]: ./orgize-common +[`orgize-wasm`]: ./orgize-wasm diff --git a/orgize-cli/Cargo.toml b/orgize-cli/Cargo.toml index 1449e26..d293cf2 100644 --- a/orgize-cli/Cargo.toml +++ b/orgize-cli/Cargo.toml @@ -5,7 +5,7 @@ authors.workspace = true repository.workspace = true edition.workspace = true license.workspace = true -description = "CLI tools for org-mode file, powered by orgize." +description = "Common line utility for org-mode files, builtin with orgize." [dependencies] anyhow = "1.0.75" diff --git a/orgize-cli/README.md b/orgize-cli/README.md new file mode 100644 index 0000000..16a83cf --- /dev/null +++ b/orgize-cli/README.md @@ -0,0 +1,5 @@ +# Orgize CLI + +Common line utility for org-mode files, builtin with [`orgize`]. + +[`orgize`]: https://crates.io/crates/orgize diff --git a/orgize-common/Cargo.toml b/orgize-common/Cargo.toml index f7e3593..fe2f0be 100644 --- a/orgize-common/Cargo.toml +++ b/orgize-common/Cargo.toml @@ -5,7 +5,7 @@ authors.workspace = true repository.workspace = true edition.workspace = true license.workspace = true -description = "Shared code between orgize-lsp and orgize-lsp." +description = "Shared code for orgize-cli and orgize-lsp" [dependencies] anyhow = "1.0.75" diff --git a/orgize-lsp/Cargo.toml b/orgize-lsp/Cargo.toml index 0093b76..6065604 100644 --- a/orgize-lsp/Cargo.toml +++ b/orgize-lsp/Cargo.toml @@ -5,7 +5,8 @@ authors.workspace = true repository.workspace = true edition.workspace = true license.workspace = true -description = "Language server for Org-mode, powered by orgize." +description = "Language server for org-mode files, builtin with orgize." +exclude = ["editors"] [dependencies] orgize = { path = "../orgize" } diff --git a/orgize-lsp/README.md b/orgize-lsp/README.md index 3c4e569..48bdbf8 100644 --- a/orgize-lsp/README.md +++ b/orgize-lsp/README.md @@ -1,6 +1,8 @@ # `orgize-lsp` -Language server for org-mode, powered by orgize. +Language server for org-mode, builtin with [`orgize`]. + +[`orgize`]: https://crates.io/crates/orgize ## Install @@ -45,6 +47,10 @@ $ code --install-extension ./editors/vscode/orgize-lsp.vsix --force - Evaluate source block -6. Commands +6. Completion + + - Various blocks: ` Result> { - Ok(completion::completion(params, &self)) + Ok(completion::completion(params, self)) } async fn completion_resolve(&self, params: CompletionItem) -> Result { diff --git a/orgize-wasm/package.json b/orgize-wasm/package.json index 17f8c82..7c22f42 100644 --- a/orgize-wasm/package.json +++ b/orgize-wasm/package.json @@ -1,6 +1,6 @@ { "name": "orgize", - "version": "0.0.3", + "version": "0.10.0-alpha.0", "license": "MIT", "author": "PoiScript ", "scripts": { @@ -10,8 +10,8 @@ "type": "git", "url": "https://github.com/PoiScript/orgize" }, - "module": "orgize.js", - "typings": "orgize.d.ts", + "module": "./dist/orgize.js", + "typings": "./dist/orgize.d.ts", "exports": { ".": { "types": "./dist/orgize.d.ts", diff --git a/orgize/Cargo.toml b/orgize/Cargo.toml index 40b2a0a..c0d1f7d 100644 --- a/orgize/Cargo.toml +++ b/orgize/Cargo.toml @@ -8,7 +8,6 @@ readme = "README.md" edition.workspace = true license.workspace = true keywords = ["orgmode", "org-mode", "emacs", "parser"] -exclude = ["/wasm", "/.github"] [package.metadata.docs.rs] all-features = true