Tana Paste - General text formatting and Copy weblink as markdown

Hey Gang!

I've been struggling to make a few KM macros work for the past couple weeks. I haven't used KM for a while and now I feel like I just don't know what I'm doing (not that I really did before).

I could really use some help!

Tana doesn't yet have comprehensive text formatting options for strikethrough and highlight. What I am trying to do is copy the selected text to clipboard, enclose the markdown syntax and add %%tana%% above this. So each would look like this pre-paste in the clipboard.

%%tana%%
- ==hightlighted text==
%%tana%%
- ~~striked text~~
%%tana%%
- [weblink title](weblink URL)

It should be easy... but I just can't make any of it work.

Please help :see_no_evil:

I don't really follow what you want to do.

Could you should examples of before and after the translation?

Hey Peter,

This is what I want to do for Highlights:

  1. Select text

  1. Keyboard Maestro shortcut trigger runs its magic to copy selected text to the clipboard and then add markdown syntax to the text stored in the clipboard

2.1. For text I want to highlight it adds ^^ to the start and end of the text

  1. Keyboard Maestro also adds %%tana%% to the top of the clipboard text. (This tells Tana to convert the markdown and render the highlight when pasting into the app)

  1. CMD+V to paste the output in Tana renders like this

I want to then create two more KM Macros, one for Strikethrough text and other to grab the weblink of a web URL (following the same principle as above).

Thank you for helping! :smiling_face_with_three_hearts:

  • Are Tana clipboards just plain text ?

  • What will you be copying, and from where, when you 'grab the weblink of a web URL' ?

    • How will you distinguish between the name/label part and the URL part ?

This page seems to shed some light on what you are asking, I notice:

Tana Paste - Tana Help Center

Hi ComplexPoint,

Are Tana clipboards just plain text ?

Yes. Same would apply to any text copied from say Roam Research or Obsidian.

What will you be copying, and from where, when you 'grab the weblink of a web URL' ?

For example, this website https://help.tana.inc/index.html would render as this Tana Help Center - Tana Help Center

This page seems to shed some light on what you are asking, I notice:

Tana Paste - Tana Help Center

Yes, it provides the formatting for Tana Paste but no help in building a KM macros :see_no_evil:

but I think the question is what will you be copying, and what will be in the clipboard.

If you copy that URL directly, from plain text, as above, then the label Tana Paste - Tana Help Center won't be in the clipboard with it.

How are you planning to obtain it ?

In Chrome I use this: Copy as Markdown - Chrome Web Store

I was hoping to bypass this completely and have KM do it for me.

So cycling back to that question – still, I think, unanswered:

  • From where are you copying the URL ? (Tana text ? Chrome ?)
  • What will be in the clipboard ?
    • Just a URL copied from plain text in Tana ?
    • An existing markdown [label](link) string pattern constructed by a Chrome plugin ?

Apologies if my answer was unclear.

Simply, I want to copy a website link from Safari or Chrome, format it as markdown, and then paste it into Tana.

I’m not knowledgeable enough to explain more than this, which is why I provided the Chrome extension as an example of what I’m trying to achieve :see_no_evil:

1 Like

So my impression now is:

For paste highlighted

Initial clipboard text:

some text to highlight

KM-generated clipboard text:

%%tana%%
- ==some text to highlight==

For paste struck

Initial clipboard text:

some text to strike through

KM-generated clipboard text:

%%tana%%
- ~~some text to strike through~~

For copy URL from browser to paste in Tana

You could use the Keyboard Maestro tokens:

to assemble your

%%tana%%
- [title](URL)

for pasting.

1 Like

So, for example, escaping the % characters to avoid their interpretation in terms of KM token syntax, perhaps – for the highlight case – something like:

1 Like

YOU-ABSOLUTE-LEGEND!!!

Thank you @ComplexPoint, all of the above worked perfectly and now you've given me the foundation to build out more macros. Thank you so much!! :smiling_face_with_three_hearts::raised_hands:

2 Likes

@ComplexPoint , one last question... though I'm not sure if it is possible.

Can one change the default Paste action from CMD+V to CMD+SHFT+V?

In Tana, CMD+V pastes to a new line, which works perfectly if I am copying text outside Tana and pasting as a highlight or strikethrough into Tana.

However, if I am working within Tana and copy text I must use CMD+SHFT+V to paste into the same bullet.

To better illustrate, please see below:

CleanShot 2023-04-08 at 14.20.51

Your thoughts would be appreciated. If not possible, no worries, I am so grateful for the help you have provided. Thank you in advance.

Not sure I've understood, but here I would:

  • put the Tana-specific pasting macros in a KM group with its Available in these Applications property set to Tana (if its an app ? or is it a web-page ?)
  • Assign whatever keyboard trigger you want to the specific macro.

Hi, @shanden. If I'm understanding your request, you could use a general-purpose macro that I have shared: Augment or Filter Text

@ComplexPoint , thank you. I'll have an explore :blush::pray:
@_jims , I'll take a look. Thank you :+1:

You cannot change the behaviour of the Paste action, but it is basically just:

So if you want to do Command-Shift-V, simply do:

Replace any Insert Text by Pasting actions with Set Clipboard to Text actions followed by Pasting (as above).

3 Likes