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

Desktop,Mobile: Allow internal links to target elements using the name attribute #11671

Conversation

personalizedrefrigerator
Copy link
Collaborator

Summary

This pull request fixes a regression from #11591, which disallowed the name attribute in rendered HTML. For example,

<a name="broken-target"></a> <!-- After #11591, name= cannot be used to create link targets -->
<a id="working-target"></a> <!-- #11591 still permits creating internal links to elements with id= -->

This link is broken in Joplin 3.2: [broken link](#broken-target)

This link works in Joplin 3.2: [working link](#working-target)

By rewriting name="some-name-here" to id="some-id-here", this pull request restores the ability to jump to elements based on the user-specified name attribute.

Note

This pull request fixes a regression and thus targets release-3.2.

This regression was reported on the Joplin forum.

Testing

Automated testing: This pull request adjusts an existing automated test.
Manual testing:

  1. Start the desktop app
  2. Create a new note with the following content:
<a name="top"></a>
<div style="height: 5000px;"></div>

[top](#top)
  1. Scroll to the end of the rendered note.
  2. Click the "top" link.
  3. Verify that the viewer scrolls to the top of the note.

@laurent22 laurent22 merged commit 2c1aa5d into laurent22:release-3.2 Jan 18, 2025
7 checks passed
@executed
Copy link

executed commented Jan 24, 2025

"Perform action" keyboard shortcut (I think it's from RichMardown plugin) still doesn't work when cursor is on the intra-note link.
Even though shortcut is 3rd-party - it uses core code for navigation. I think it's the same as right-click -> "Open Link" in MD editor.

Cross-note link to header e.g. here works as expected both when using "Open Link" & "Perform action" keyboard shortcut.

Do you happen to know if there is open issue for this?

P.S. sorry if this is more HTML related, but links look the same that's why I'm asking.

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

Successfully merging this pull request may close these issues.

3 participants