dbrgn / tealdeer

A very fast implementation of tldr in Rust.
https://dbrgn.github.io/tealdeer/
Apache License 2.0
4.06k stars 123 forks source link

Change custom page files to use a `.md` extension. #322

Closed zedseven closed 6 months ago

zedseven commented 1 year ago

My rationale for this PR is in #320. Closes #320.

To summarise, the lack of a .md extension causes problems for external tools working with the custom page files, and my solution is to simply add the extension to the end.

e.g.

This will be a breaking change for anyone using custom pages.

niklasmohrin commented 1 year ago

As I outlined in the issue thread, let's first find out how we want to handle this breaking change if we want it. Happy to continue discussion here once we are all on the same page :)

dbrgn commented 6 months ago

As commented in https://github.com/dbrgn/tealdeer/issues/320#issuecomment-1937775105, I think it's valuable to print a warning when pages with .page or .patch extension are found in the custom pages directory. This will be a small performance hit, but we can remove it again after 1-2 releases.

@zedseven would you be willing to add such a check?

dbrgn commented 6 months ago

Could you add a breaking change warning to the docs?

diff --git a/docs/src/usage_custom_pages.md b/docs/src/usage_custom_pages.md
index 7024abd..d5d0f89 100644
--- a/docs/src/usage_custom_pages.md
+++ b/docs/src/usage_custom_pages.md
@@ -1,5 +1,13 @@
 # Custom Pages and Patches

+> ⚠️ **Breaking change in version 1.7.0:** The file name extension for custom
+> pages and patches was changed:
+>
+> - `<name>.page` → `<name>.page.md`
+> - `<name>.patch` → `<name>.patch.md`
+>
+> If you have custom pages or patches, you need to rename them.
+
 Tealdeer allows creating new custom pages, overriding existing pages as well as
 extending existing pages.

The branch also needs a rebase against main.

zedseven commented 6 months ago

I've added the temporary check (when looking up any command), added your warning to the docs, rebased the branch onto the latest main, and fixed a bug I noticed with my initial implementation.