Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Markup in <h1>? Keep it there, but strip it from filename #92

Open
rlue opened this issue Jul 23, 2024 · 0 comments
Open

Comments

@rlue
Copy link

rlue commented Jul 23, 2024

Sometimes, I want to format my H1s with some markdown. For instance,

# [TKT-123](https://company-bug-tracker/TKT-123)

or

# A Night at the Cinema with _Agent Cody Banks_

Currently, Filename Heading Sync will rename the file TKT-123(https...).md, etc. I think it would be sensible in such cases for the plugin to strip the markup before applying the filename.

One complication is that when re-opening that file, the plugin would now revert the heading to its bare form, to match the stripped filename. I'd like to propose the following logic around this new feature:

  • When updating a heading: set the filename to the rendered (visible) text of the first H1 element.
  • When opening an existing file: first, check if the H1 contains NO markdown (perhaps by comparing the raw and rendered versions of the H1)
    • if so, proceed as usual
    • if not, check if the rendered text and the filename match.
      • if so, skip
      • if not, raise a window.alert (is this even possible?) to prompt the user re: whether to keep or update the heading. Additionally, define a config option to specify this behavior.
  • When opening a new file: no changes required.

Thoughts?

Thanks for a very handy, unobtrusive, and common-sense utility. Should really be a core plugin. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant