Skip to content
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

135 add function to insert md links #136

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions zetteldeft.org
Original file line number Diff line number Diff line change
Expand Up @@ -778,13 +778,15 @@ Note that for the best results, link descriptions should include a =zetteldeft-l
#'zetteldeft-insert-link-zd-style
"The function to use when inserting note links.

Use either
Use one of
- `zetteldeft-insert-link-zd-style' for Zetteldeft type links
- `zetteldeft-insert-link-org-style' for Org-mode zdlink: links
- `zetteldeft-insert-link-md-style' for Markdown style links
- A custom function that takes two arguments: an ID and an optional title."
:type 'function
:options '(zetteldeft-insert-link-zd-style
zetteldeft-insert-link-org-style)
zetteldeft-insert-link-org-style
zetteldeft-insert-link-md-style)
:group 'zetteldeft)
#+end_src

Expand All @@ -803,7 +805,7 @@ The default function is =zetteldeft-insert-link-zd-style=, which inserts:
(when title (insert " " title)))
#+END_SRC

Alternatively, when using Org-mode style links, =zetteldeft-insert-link-org-style= can be used.
When using Org-mode style links, =zetteldeft-insert-link-org-style= can be used.
It inserts a formatted Org-link with =zdlink:= type.
When no title is provided, the link itself is used as a descriptor.

Expand All @@ -815,6 +817,17 @@ When no title is provided, the link itself is used as a descriptor.
(insert "[[zdlink:" id "]]")))
#+end_src

Finally, when using Markdown style links, =zetteldeft-insert-link-md-style=
can be used. It inserts a

#+begin_src emacs-lisp
(defun zetteldeft-insert-link-md-style (id &optional title)
"Insert a Zetteldeft link in Markdown link format"
(if title
(insert (format "[%s](%s%s)" title zetteldeft-link-indicator id))
(insert (format "[%s%s](%s%s)" zetteldeft-link-indicator id zetteldeft-link-indicator id))))
#+end_src

*** Finding & linking files from minibuffer
**** =zetteldeft-find-file= opens file from minibuffer

Expand Down