Use markdown instead of text for help files

help-command
Michael Davis 2 years ago
parent 0e037802c2
commit 233b10f7fc
No known key found for this signature in database

@ -1816,7 +1816,9 @@ fn help(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) ->
// TODO: Open a list of commands / overview? // TODO: Open a list of commands / overview?
ensure!(!args.is_empty(), "Help topic or keybind required"); ensure!(!args.is_empty(), "Help topic or keybind required");
if args[0] == "topics" { if args[0] == "runtime" {
todo!()
} else if args[0] == "topics" {
let dir_path = helix_loader::runtime_dir().join("help/topics"); let dir_path = helix_loader::runtime_dir().join("help/topics");
struct Topic(PathBuf); struct Topic(PathBuf);
@ -1879,7 +1881,7 @@ fn help(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) ->
let mut path = helix_loader::runtime_dir(); let mut path = helix_loader::runtime_dir();
path.push("help"); path.push("help");
path.push(help_dir); path.push(help_dir);
path.push(format!("{}.txt", command)); path.push(format!("{}.md", command));
ensure!(path.is_file(), "No help available for '{}'", args_msg); ensure!(path.is_file(), "No help available for '{}'", args_msg);
let id = editor.open(&path, Action::HorizontalSplit)?; let id = editor.open(&path, Action::HorizontalSplit)?;

@ -450,7 +450,7 @@ pub mod completers {
.filter_map(|entry| { .filter_map(|entry| {
let entry = entry.ok()?; let entry = entry.ok()?;
let path = entry.path(); let path = entry.path();
(path.extension()? == "txt") (path.extension()? == "md")
.then(|| path.file_stem().unwrap().to_string_lossy().into_owned()) .then(|| path.file_stem().unwrap().to_string_lossy().into_owned())
}) })
.chain( .chain(
@ -459,7 +459,7 @@ pub mod completers {
entries.filter_map(|entry| { entries.filter_map(|entry| {
let entry = entry.ok()?; let entry = entry.ok()?;
let path = entry.path(); let path = entry.path();
(path.extension()? == "txt").then(|| { (path.extension()? == "md").then(|| {
format!(":{}", path.file_stem().unwrap().to_string_lossy()) format!(":{}", path.file_stem().unwrap().to_string_lossy())
}) })
}) })

@ -8,10 +8,10 @@ non-whitespace characters.
In the example below, the words are underlined by 'w', and the In the example below, the words are underlined by 'w', and the
WORDS are underlined by 'W'. WORDS are underlined by 'W'.
This "stuff" is not-so difficult! This "stuff" is not-so difficult!
--------------------------------- ---------------------------------
wwww wwwww ww www ww wwwwwwwww wwww wwwww ww www ww wwwwwwwww
WWWW WWWWWWW WW WWWWWW WWWWWWWWWW WWWW WWWWWWW WW WWWWWW WWWWWWWWWW
As is visible in the example, the words do not include any of the As is visible in the example, the words do not include any of the
non-alphanumeric punctuation, while the WORDS do include the non-alphanumeric punctuation, while the WORDS do include the
Loading…
Cancel
Save