Plugin: Copy Anchor Link

This plugin will add a copy link icon to each heading of the rendered note so you can easily link to specific heading.

Preview

The usage should be self-explanatory as it is quite a common feature

9 Likes

Neat! Thanks for thinking of this.

Does the link change when the sub heading text changes?

No, this plugin just simply copy current id. So if you change the title of the heading all previous links will become broken (the note is still fine though). So use it carefully.

1 Like

Hİ,

This is a nice plug-in for the shortcut of "Copy markdown link, append heading text with dashes to that link with # at the beginning."

Thank you..

Edit: Could we also see the icon in Editor too?

I am not very sure what you tried to say, but as for the icon in Editor aspect I did think about it and it is in my backlog.

However, it requires quite a bit of efforts while provide minimal benefit for my workflow as I always use split view. So it is not my priority at the moment.

If someone want to develop such plugin please feel free to do so. People then can decide to install what plugin works great with their setup without having to using both.

This might be a better fit in the Rich Markdown plugin.

@whitewall actually my idea originally comes from Rich Markdown Plug-in and i also want rich markdown to extend itself not just headers but indented list by the way. as i suggested this to @hieuthi i also thought there could be conflict between these two plug-ins but it is better to try than thinking :slight_smile:
@CalebJohn may want to see this?

"We were doing what your plug-in does manually before it showed up" that is what i am saying in my previous post and i just showed the manual way of things. Thank you again.

Don't you want to hear any feedback?

Not really though as i don't want this to be my full time job. I just developed these plugins to improve my own workflow and so give back to the community for whoever need the same solution.

That being said, feel free to give feedback in my threads or anywhere in the forum. I do adopt some good ideas if it benefits me while not a too demanding task. Or maybe someone could read it and realize it.

4 Likes

Version 1.1.0

Changed

  • Changes icon appearance
  • Changes default format

Added

  • Add 6 more link formats

Link format:

  • OI: #welcome-to-joplin
  • OF: :/524d6874790f4e33a1dd2f5b2463c6cb#welcome-to-joplin
  • LI: [welcome-to-joplin](#welcome-to-joplin)
  • LH: [Welcome to Joplin!](#welcome-to-joplin)
  • GI: [welcome-to-joplin](:/524d6874790f4e33a1dd2f5b2463c6cb#welcome-to-joplin)
  • GH: [Welcome to Joplin!](:/524d6874790f4e33a1dd2f5b2463c6cb#welcome-to-joplin)
  • (Default) GF: [1. Welcome to Joplin! # Welcome to Joplin!](:/524d6874790f4e33a1dd2f5b2463c6cb#welcome-to-joplin)

All the formats but one are hidden by default, you can enable them by adding to your userstyle.css. Please check github for further instructions.

First, thanks for developing this plugin. I found very useful.
Using it, I found that by default showing 14 link icons after the headers plus the defaulted GF link:

And after enable the different types of link, these will increase to 21 link icons.

Why does my Joplin screen show these numbers of links icons different from screenshot you use in plugin README,md file.
Are these 14 + 1 icons showing by default, OK? Same number are showing in Joplin iphone or ipad devices.
I have played changing userstyle.css file in different way, even I have removed all the data there, but always showing 14 + 1 GF icon as a minimum amount of icons.
Is another plugin running jointly with this plugin that produce it? I have checked disabling some installed plugin that manage link or similar feature but nothing changed it.
Please, Can you help me?.
Joplin 2.8.7 (prod, linux)
Desktop Ubuntu 22.04

The links icon should only appear on the right side (rendered markdown) not the left side (source text) so somehow you have 14 icons in the left side. It is not a part of the plugin so you can simply delete the 14 icons on the left side and it will be fine.

The question remains thought while these 14 icon appear on the left side, so I have two hypotheses:

    1. Some other plugin somehow make the icon in the rendered view into source text
    1. You are using WYSIWYG mode to edit the heading which broke the html and convert it to raw source text. As the Joplin WYSIWYG mode is highly problematic, especially if you are using it in tandem with markdown mode. None of my plugin (and most plugins) will not work with WYSIWYG mode and will likely have some unexpected behavior.

The second is most likely the problem you has. So if you still want to use this plugin what you can do is (A) Don't use WYSIWYG mode or (B) if using WYSIWYG mode just remember don't edit the heading or (C) if you forgot and edit the heading then just need to remove the icon afterward in the markdown mode, as it is not a very serious bug.

I would encourage to go with (A) but I know some users just have to use the WYSIWYG so you just have to decice a compromise solution for yourself.

Hi
Right I removed these icons from markdown editor, and also create a new note, and they do not show any icons.
As I never use WYSIWYG mode editor, and checking which notes showing this behavior, following your approach, I assume as a possible source of problem was in the past I used Typora as external editor for long notes that in coincidence present these amount of icons.
I could not check this assumption because I remove Typora, but I remember on typora I wrote using its WYSIWYG mode.
I will pay attention in the future to check this behavior but using Joplin markdown editor I believe this will not happen again for new note.
Thanks for your help.

Using Joplin 2.11.11. Editing the note in WYSIWYG mode always adds the 7 link icons (even if I don't edit the headers). Editing the note twice in WYSIWYG mode adds another set of 7 icons (7+7=14), and so on.

Basically this plugin is incompatible with WYSIWYG mode (unless you accept the fact that you have to manually remove all the added icons from the headers whenever you edited the note in WYSIWYG mode).

Given that I rarely use the Wysiwyg mode (basically I use it only to resize pictures), the workaround I found is to disable the plugin before editing in wysiwyg mode, and re-enabling it just after.

You're right. It seems any interactive with the WYSIWYG mode will cause trouble. Unfortunately, I don't have a solution for it so this plugin is not compatible with WYSIWYG mode.

No problem. I found a CSS solution for my need to enforce image sizes, and ended up disabling the wysiwyg editor altogether, just to make sure not to use it by accident. MD is easy enough to use...

Basically wysiwyg isn't an option for a lot of plugins, including some native options of Joplin ([toc] for example behaves badly too after a wysiwyg edit, replacing the table of content by a static bullet list).

@laurent why is this not integrated into the main app? Are you opposed to the integration?

Why is that feature not integrated into joplin? @laurent22 are you opposed to that? I mean that is a feature that makes life easier and does not hurt anyone and I think many would use it. At a minimum it is a better workaround than copying the id, the going to note, then remembering the syntax and then writing, as it is right now.

And a very important is, that it gets integrated into the PHONE APP.

Many note taking apps has this function with different approaches, but never with such difficult a approach as joplin. for example notion has a button "copy link to block" for example. But this approach presented by @hieuthi is the best i think.

@hieuthi made it like in github, am i correct? If so I think it needs to be polished before integrating. For example It would be better if the icon would be smaller, like github does
image. I would also suggest to darken the color. And of course the main thing is to remove the letters
image

Alright but before that a jump to the title should be implemented. External link to an anchor