I wrote a plugin to make inline spans which, when clicked on, copy their contents to the user's clipboard. The spans are unobtrusively styled, and the plugin works on desktop and mobile. The spans do support displaying inline code, but otherwise do not display markdown within them - intentional since I use it to copy passwords, which may inadvertently contain valid markdown.
The basic format is that something like [[this]]
in the editor will be rendered as a click-to-copy span in the webview which, when clicked, copies "this" to the user's clipboard. Any click-to-copy span that has its contents entirely encased in backticks, like [[`this`]]
, will have its contents displayed as inline code, while still click-to-copying (without the backticks).
There are settings to change the start and end tokens from [[ and ]] to whatever you may want to use.
GitHub: GitHub - ntczkjfg/joplin-plugin-click-to-copy-span (includes a screenshot)
Full documentation:
Joplin Plugin - Click-to-Copy Spans
This Joplin plugin allows you to create inline click-to-copy text spans.
Version: 1.3.0
Installation
- Open Joplin and navigate to
Preferences > Plugins
- Search for
click-to-copy
and click install - Restart Joplin
Uninstall
- Open Joplin and navigate to
Tools > Options > Plugins
- Find the
Click to copy
plugin - Press
Delete
to remove the plugin, or click the toggle to disable it - Restart Joplin
Usage
Click-to-copy spans
In order to create a Click-to-Copy Span, you can:
- press on the
Click-to-Copy Span
toolbar button to create a template span, or - highlight text then press on the
Click-to-Copy Span
toolbar button to convert it to a span, or - or manually type in the following format:
[[insert text here]]
You can additionally make the text within the span render as inline code by wrapping the entire contents of the span in backticks, like so:
[[`This will render as inline code, but still be click-to-copy`]]
If you double the start token, then the span will render its text as dots, to obfuscate things like passwords. If you double the end token, then the plugin will attempt to clear your clipboard after 15 seconds. When a span is rendered as a password, right clicking it will toggle between displaying dots and the actual text.
[[[[`This will show up as dots, and be erased from the clipboard 15 seconds after being clicked`]]]]
Screenshots
Use it for things you may frequently want to copy/paste:
With password obfuscation and forgetting:
With editor view enabled (default):
Settings
There is a settings page for the plugin in the Joplin options. There, you can:
- Customize the start and end tokens away from the default
[[
and]]
- Disable having the spans appear in the editor if you'd prefer only the raw text there
- Choose if the start and end tokens are shown or hidden, when displaying spans in the editor is enabled
Advanced
Custom styles
If you would like to style the collapsible blocks to your preference, use the following in your userstyle.css
file, which can be accessed in Joplin
β Options
β Appearance
β Show Advanced Settings
β Custom stylesheet for rendered Markdown
:
/* Styling of the click-to-copy spans */
.ctc {
}
/* Styling of the ctc-markdown, only when displaying ctc-spans in the editor, and not hiding markdown */
.ctc-markdown {
}
Notes
- There might be bugs, report them here and I'll try to fix them if I can.
Acknowledgement
Thanks to the creator of the Joplin Spoilers plugin, whose code helped me build this plugin.
Other plugins
Check out my other plugins:
- Collapsible blocks! Easily lets you create collapsible/foldable blocks that can hide their content from view.
- Hotstrings & Hotkeys! Easily define custom hotstrings and hotkeys you can use in any note.