Use markdown instead of text for help files

This commit is contained in:
Michael Davis 2022-12-12 20:27:33 -06:00
parent 0e037802c2
commit 233b10f7fc
No known key found for this signature in database
62 changed files with 10 additions and 8 deletions

View File

@ -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 label(&self, _data: &Self::Data) -> Spans {
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)?;

View File

@ -450,7 +450,7 @@ pub fn help(_editor: &Editor, input: &str) -> Vec<Completion> {
.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 fn help(_editor: &Editor, input: &str) -> Vec<Completion> {
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())
}) })
}) })