Giter Club home page Giter Club logo

Comments (7)

saf-dmitry avatar saf-dmitry commented on August 12, 2024

What should happen when you click on such link in a TaskPaper file?

from taskpaper-mode.

wakatara avatar wakatara commented on August 12, 2024

Hey @saf-dmitry

You should simply go to the org-roam page indicated. Though it would be nice if the [[ ... ][...]] for the links was honoured so that you only see the "title" of the link you'd be heading to rather than the full linking style. Does that make sense?

from taskpaper-mode.

saf-dmitry avatar saf-dmitry commented on August 12, 2024

@wakatara TaskPaper mode already supports inline Markdown links in form [Description](URI) as described in the manual. When markup hiding is enabled, only the description part is displayed as hyperlink making the link more readable.

You can delegate opening id: links to Org-roam by adding the following lines to your Emacs init file:

(defun my-org-open-uri (uri)
  (when (string-prefix-p "id:" uri)
    (org-open-link-from-string (format "[[%s]]" uri))
    t))

(add-hook 'taskpaper-open-uri-hook 'my-org-open-uri)

Now you can write something like this in your TaskPaper documents:

- Ping [Boss](id:F5531E65-5ECB-465C-9384-0B9BBF04C8B4) on that thing ...

Clicking on the link should take you to the corresponding Org-roam node (assuming Org-roam is already installed and configured).

See the corresponding example in the Scripting Guide and the documentation string of taskpaper-open-uri-hook for more details and inspiration.

from taskpaper-mode.

wakatara avatar wakatara commented on August 12, 2024

@saf-dmitry

Hey! Thanks for the quick response. The link opening works great once you insert that function. Very helpful.

Ah, I think I must have miscommunicated my intent with the links though.

Org-roam links use org-mode style so are of the form [[link uri][description]] rather than markdown []() style so they are neither highlighted nor clickable. And of course, having the mark up hidden for those so they only display their description would be amazing as well.

from taskpaper-mode.

saf-dmitry avatar saf-dmitry commented on August 12, 2024

@wakatara

I understand that you suggest supporting Org mode link syntax. However, honestly I don't see any good reason to support Org links (as many other link syntaxes) in the TaskPaper mode.

Why are Markdown links not working for you?

This is nicely inserted with C-n i and a handy ivy narrowing to the thing you select.

Could you elaborate this a bit more? What does C-n i exactly do? Is it bound to org-roam-node-insert?

from taskpaper-mode.

wakatara avatar wakatara commented on August 12, 2024

@saf-dmitry

Completely understand your position. If it wasn't for tools like org-roam and org-journal in emacs and a few others in the ecosystem, I'd strongly prefer markdown everywhere myself (in fact, trying to see if I can get md-roam with org-roam working.). I'm a much bigger proponent of markdown myself.

But... in using emacs, it feel like org-mode has a special place even if you choose not to use it for org-agenda (which I'm obviously doing if using taskpaper mode), so I'd assert that supporting the org-mode link protocol is about as important as markdown's.

In org-roam, C-c n i calls org-roam-node-insert which brings up minibuffer you can type into to fuzzy search a node (mine's integrated with ivy) or it create an org-capture buffer with a templated org-mode file to allow you to create a new entry. The insert also then inserts an org-mode link to the document in question into your existing buffer.

If you've ever seen Roam Research or Logseq, the idea with org-roam is that it creates bidrectional links that you can then traverse to navigate or surface your information or see the backlinks to it (which is the handy feature) in order to understand it in your collections of documents and "knowledge graph" better. It's pretty handy.

from taskpaper-mode.

saf-dmitry avatar saf-dmitry commented on August 12, 2024

@wakatara

You can convert an Org-roam link at point to Markdown syntax using the following function:

(defun my-org-convert-link ()
  (interactive)
  (require 'thingatpt)
  (let ((re "\\[\\[\\(.*?\\)\\]\\(?:\\[\\(.*?\\)\\]\\)?\\]"))
    (when (and (derived-mode-p 'taskpaper-mode)
               (thing-at-point-looking-at re))
      (let* ((uri  (match-string-no-properties 1))
             (desc (or (match-string-no-properties 2) uri)))
        (delete-region (match-beginning 0) (match-end 0))
        (insert (format "[%s](%s)" desc uri))))))

You could probably advise the org-roam-node-insert function to automatically execute my-org-convert-link after inserting a link in a TaskPaper buffer by adding something like this (not tested):

(advice-add 'org-roam-node-insert :after #'my-org-convert-link)

from taskpaper-mode.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.