-
Notifications
You must be signed in to change notification settings - Fork 94
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: Add page anchors and inter page links #2464
Conversation
Implements the anchors needed for inter-page links, closes #2173. IDs are generated using a similar slugify function github and gitlab use. For initial content markdownit-anchor is used. Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Using ProseMirror view decorations to display visible anchor links on headings. Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
/compile amend/ |
I've just taken a fast look into this implementation and remove this behavior from workspace rich editor. Despite small CSS bugs (master branch) seem it works. It is the only way to do it? @susnux |
Sorry, CSS is not one of my strengths, I get it work but it might not that clean (help one the CSS part is highly welcome)
I thought it might be the easiest way, as the links should only be visible on the frontend and not serialized.
No, two other option I can imagine:
So from my point decorations are a cleaner way, but |
The failing tests are somewhat related to #2217 as they come from the |
Extending the Heading node sounds reasonable to me. We already extend from the tiptap one in Line 3 in 87aa069
|
@vinicius73 @juliushaertl How about doing it this way: master...susnux:feature/lightweight-inter-page I rewrote it to be similar to the already existing custom nodes. |
Yes, looks reasonable to me from a first look. @vinicius73 What do you think? |
created a new PR from the modified (lightweight) version: #2520 |
Summary
Implements the anchors needed for inter-page links
This requests consists of three commits, the first part adds the required anchors.
IDs are generated using a similar slugify function github and
gitlab use.
For initial content markdown-it-anchor is used.
The second part implements visible links, using ProseMirror view decorations.
The last part is handling opening inter-page links, as just adding an onClick listener
using
Element.scrollIntoView()
would not handle user defined links within the document.And the current default handler would open the document again in a new tab.