9

In an emacs org-mode buffer it is possible to type a hyperlink and then click on the hyperlink with a mouse to open the url in an external browser.

Is there a way for markdown mode to have active hyperlinks as well?

Kevin Wright
  • 359
  • 1
  • 16
  • Have you seen [how to export](http://orgmode.org/manual/Markdown-export.html) org-mode doc to markdown? Alternatively, you can use [pandoc](http://pandoc.org) to export org-mode doc to markdown with a few more customizations (to the links, for example). – Emacs User Sep 15 '16 at 23:35
  • If you have the point on the hyperlink, you can also `M-x ffap` (short for find file at point) and it opens the default browser with the url at point. (but goto-address-mode is the good answer) – Ehvince Sep 16 '16 at 17:18

4 Answers4

8

This isn't easy enough to find, but what you want is goto-address-mode. You can activate it in the current buffer with M-x goto-address-mode or you can add it to markdown-mode-hook:

(defun turn-on-goto-address-mode ()
   (goto-address-mode 1))
(add-hook 'markdown-mode-hook #'turn-on-goto-address-mode)
amitp
  • 2,451
  • 12
  • 23
  • Thanks. Two notes from goto-addr.el. 1. Suggested use is (add-hook 'mh-show-mode-hook 'goto-address) 2. If the buffer is fontified after goto-address-fontify is run (say, using font-lock-fontify-buffer), then font-lock faces will override goto-address faces. – Kevin Wright Sep 16 '16 at 13:43
  • Ah! Good to know. – amitp Sep 16 '16 at 19:55
5

In the current development version of Markdown mode, links are now clickable without requiring any additional libraries. URLs can also be hidden, and you can hover your mouse pointer to see the URL and optional title text.

Jason Blevins
  • 640
  • 5
  • 12
  • 2
    More specifically, either `^C ^X ^L` or `M-x markdown-toggle-url-hiding` or add `(markdown-toggle-url-hiding t)` to your `markdown-mode-hook` – crimson-egret Jan 17 '18 at 01:22
0

Answering my own question, here's the setup I use now to make clickable hyperlinks in prog-mode (useful for URLs within comments) and text-mode (which includes markdown).

(use-package goto-addr
  :bind
  (:map goto-address-highlight-keymap
        ("C-c C-o" . goto-address-at-point))
  :hook ((prog-mode . goto-address-prog-mode)
         (text-mode . goto-address-mode)))
Kevin Wright
  • 359
  • 1
  • 16
-1

In an emacs org-mode buffer it is possible to type a hyperlink and then click on the hyperlink with a mouse to open the url in an external browser.

Yes this can be done without any additional code.

The format in which you have enter URLs in org-mode file is [[http://www.google.co.in][Google India]]. This will open the webpage (in your default browser) on a click event.

This is how it looks in my org file
Hyperlink in org-mode
Manual reference

Prasanna
  • 1,470
  • 16
  • 30
  • The question is about markdown mode, not about exports. – amitp Sep 16 '16 at 19:56
  • You're right. I answered the first part of the question right. I misunderstood the second part. Edited my answer to remove the markdown portion – Prasanna Sep 17 '16 at 00:48