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

render anchor title instead of page title #8

Closed
usulpt opened this issue Mar 27, 2024 · 4 comments
Closed

render anchor title instead of page title #8

usulpt opened this issue Mar 27, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@usulpt
Copy link

usulpt commented Mar 27, 2024

hello!

been using the plugin and it works great, however when I use anchors within the aliases, the rendered title is always for the main page and not for the anchor itself. is it possible to render the anchor title instead?

thank you!
Jorge

@EddyLuten EddyLuten added the enhancement New feature or request label Mar 30, 2024
@EddyLuten EddyLuten self-assigned this Mar 30, 2024
@EddyLuten
Copy link
Owner

Hi Jorge, thanks for filing this issue! This could certainly be accomplished on a technical level, though it would have to be an opt-in feature configured through mkdocs.yml since it would change the existing behavior, and I don't want to break the plugin for other users.

I'll take a look at implementing it, though I'm not sure when I'll get to it. For now, as a workaround, I suggest using custom titles:

[[the-alias#anchor|Custom Title]]

@usulpt
Copy link
Author

usulpt commented Apr 1, 2024

yeah, that's exactly what I've been doing for now, but it would be a welcome addition for automation and fire-and-forget editing. still, just thought I'd make the suggestion :)
cheers and kutgw,
Jorge

@EddyLuten
Copy link
Owner

Alright, I figured I'd give it a whirl and implemented the feature today. After upgrading to version 0.8.0, you should be able to enable the config flag use_anchor_titles and begin pulling in titles from headings.

This will only work for anchors generated through Markdown headings, which should be fine for most cases since embedded HTML is a bit of an edge case anyway. Meaning that it won't work for other types of anchors, such as pure HTML anchors, e.g.: <a name="anchor">...

Let me know if this works for you. I'm already beginning to use it in my personal KB. Thanks for the feature suggestion!

@usulpt
Copy link
Author

usulpt commented Apr 8, 2024

wow, didn't think you'd actually pick this up any time soon, so our productive builds can't be changed, but I've tested in in our test environment and it looks good, going to ship it in the next builds, thank you so much! :)

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

No branches or pull requests

2 participants