Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Feel-ix-343/obsidian-markdown-ls
Browse files Browse the repository at this point in the history
  • Loading branch information
Feel-ix-343 committed May 21, 2024
2 parents 91bc118 + dd4fc0f commit 0f3116f
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 13 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
[package]
name = "markdown-oxide"
version = "0.1.0"
version = "0.0.21"
edition = "2021"
repository = "https://github.com/Feel-ix-343/markdown-oxide"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0.80"
chrono = "0.4.35"
config = "0.14.0"
fuzzydate = "0.2.2"
indexmap = "2.2.6"
itertools = "0.10.5"
nanoid = "0.4.0"
Expand All @@ -25,3 +27,6 @@ shellexpand = "3.1.0"
tokio = { version = "1.34.0", features = ["full"] }
tower-lsp = { git = "https://github.com/Feel-ix-343/tower-lsp" }
walkdir = "2.4.0"

[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-v{ version }-{ target }{ archive-suffix }"
68 changes: 64 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Markdown Oxide

Markdown Oxide is attempting to be the best PKM system for software enthusiasts - people like me who (in addition to note-taking) are addicted to creating the best text editing experience.
Markdown Oxide is attempting to be the best Personal Knowledge Management (PKM) system for software enthusiasts - people like me who (in addition to note-taking) are addicted to creating the best text editing experience. **Bring your own text editor and let `markdown-oxide` be your PKM!**

Obsidian strongly inspires Markdown Oxide's PKM features - in fact, Markdown Oxide is fully compatible with your Obsidian vault. Markdown Oxide does not aim to fully replace Obsidian; it serves to provide a feature-rich and advanced note-taking experience. Obsidian remains a terrific front-end for your linked markdown notes. Also, in terms of features, Markdown Oxide and Obsidian are quite alligned.

Expand All @@ -22,6 +22,15 @@ Markdown Oxide's features are implemented in the form of a language server aimin
```

</details>

- <details>
<summary>Cargo binstall[1] (from hosted binary)</summary>

```bash
cargo binstall --git 'https://github.com/feel-ix-343/markdown-oxide' markdown-oxide
```

</details>

- <details>
<summary>AUR (from source)</summary>
Expand Down Expand Up @@ -99,6 +108,30 @@ Markdown Oxide's features are implemented in the form of a language server aimin
</details>
- <details>
<summary>(optional; requires latest commit) Enable opening daily notes with natural langauge</summary>
Modify your lsp `on_attach` function to support opening daily notes with, for example, `:Daily two days ago` or `:Daily next monday`. The specification can be found [here](https://docs.rs/fuzzydate/latest/fuzzydate/)
```lua
-- setup Markdown Oxide daily note commands
if client.name == "markdown_oxide" then
vim.api.nvim_create_user_command(
"Daily",
function(args)
local input = args.args
vim.lsp.buf.execute_command({command="jump", arguments={input}})
end,
{desc = 'Open daily note', nargs = "*"}
)
end
```
</details>
### VSCode
Expand All @@ -114,6 +147,15 @@ Install the [vscode extension](https://marketplace.visualstudio.com/items?itemNa
```
</details>
- <details>
<summary>Cargo binstall[1] (from hosted binary)</summary>
```bash
cargo binstall --git 'https://github.com/feel-ix-343/markdown-oxide' markdown-oxide
```
</details>
- <details>
<summary>AUR (from source)</summary>
Expand Down Expand Up @@ -145,6 +187,15 @@ Markdown Oxide is available as an extension titled `Markdown Oxide`. Similarly t
```
</details>
- <details>
<summary>Cargo binstall[1] (from hosted binary)</summary>
```bash
cargo binstall --git 'https://github.com/feel-ix-343/markdown-oxide' markdown-oxide
```
</details>
- <details>
<summary>AUR (from source)</summary>
Expand Down Expand Up @@ -177,6 +228,15 @@ For Helix, all you must do is install the language server's binary to your path.
</details>
- <details>
<summary>Cargo binstall[1] (from hosted binary)</summary>
```bash
cargo binstall --git 'https://github.com/feel-ix-343/markdown-oxide' markdown-oxide
```
</details>
- <details>
<summary>AUR (from source)</summary>
Expand Down Expand Up @@ -287,6 +347,7 @@ Generally, this is `[[relativeFilePath(#heading)?(|display text)?]]` e.g. [[arti
</details>
- [ ] Subheading completions in the form [[file#heading#subheading]] from https://help.obsidian.md/Linking+notes+and+files/Internal+links#Link+to+a+heading+in+a+note (Note: right now you can link to subheadings through [[file#subheading]])
- [ ] Headings in the current file
- [ ] Metadata completions
- [ ] Dataview completions
- [ ] Metadata tag completions
Expand Down Expand Up @@ -490,7 +551,6 @@ Here are the alternatives (open source authors are welcome to make PRs to add th
- https://github.com/WhiskeyJack96/logseqlsp: This is a cool project and a great inspiration for Logseq support (which is upcoming). status: it doesn't seem that it is maintained and it (obviously) does not provide support for all of the obsidian syntax
- The og https://github.com/artempyanykh/marksman: I used this for a while, but it is not obsidian specific and didn't act well with my vault. Additionally, the block completions in markdown-oxide allow for a fuzzy/grep search of the entire vault to generate the completions; I don't think Markman has any features like this; (this is a feature that Logseq signified for PKM; the concept that *anything is linkable* is quite powerful)
## Links
## ---The--bottom--line--------------------------------------------------
Listen. I really like Vim motions. I also really love low-latency terminal editing. I very much so also like my Neovim LSP plugins, keymappings, and config. But Wow! I also like using Obsidian and Logseq. **Can't I just have it all???** Can't I be whisked away by the flow of Neovim while also experiencing the beauty of Obsidian???? Can't I detail my tasks on the CLI while viewing them in Logseq????? Well, I thought I could; now for us all, there is markdown-oxide (which is still very pre-beta fyi)
1: https://github.com/cargo-bins/cargo-binstall
19 changes: 14 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::collections::HashSet;
use std::ops::{Deref, DerefMut};
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::path::PathBuf;
use std::sync::Arc;

use completion::get_completions;
Expand All @@ -23,6 +22,7 @@ use vault::Vault;

mod codeactions;
mod codelens;
mod commands;
mod completion;
mod config;
mod diagnostics;
Expand Down Expand Up @@ -291,9 +291,10 @@ impl Backend {
#[tower_lsp::async_trait]
impl LanguageServer for Backend {
async fn initialize(&self, i: InitializeParams) -> Result<InitializeResult> {

let root_dir = match i.root_uri {
Some(uri) => uri.to_file_path().or(Err(Error::new(ErrorCode::InvalidParams)))?,
Some(uri) => uri
.to_file_path()
.or(Err(Error::new(ErrorCode::InvalidParams)))?,
None => std::env::current_dir().or(Err(Error::new(ErrorCode::InvalidParams)))?,
};

Expand Down Expand Up @@ -371,7 +372,7 @@ impl LanguageServer for Backend {
resolve_provider: None,
}),
execute_command_provider: Some(ExecuteCommandOptions {
commands: vec!["apply_edits".into()],
commands: vec!["apply_edits".into(), "jump".into()],
..Default::default()
}),
semantic_tokens_provider: Some(
Expand Down Expand Up @@ -585,6 +586,14 @@ impl LanguageServer for Backend {

Ok(None)
}
ExecuteCommandParams { command, .. } if *command == *"jump" => {
let jump_to = params.arguments.first().and_then(|val| val.as_str());
let settings = self
.bind_settings(|settings| Ok(settings.to_owned()))
.await?;
let root_dir = self.bind_vault(|vault| Ok(vault.root_dir().to_owned())).await?;
commands::jump(&self.client, &root_dir, &settings, jump_to).await
}
_ => Ok(None),
}
}
Expand Down

0 comments on commit 0f3116f

Please sign in to comment.