summaryrefslogtreecommitdiffstats
path: root/lisp/init-markdown.el
blob: 03214ee59e5f9508bd88b3c430eb2a7d1d888f5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;;; init-markdown.el --- configure markdown language support  -*- lexical-binding:t -*-
;;; Commentary:
;;; Code:

(defun mpolden/browse-help-at-point ()
  "Browse help URL at point.

The URL is extracted from the help text found at point, if any."
  ;; markdown-mode fontifies links by adding them to the help-echo property
  ;; allows visiting links in documentation shown by eglot/eldoc
  (interactive)
  (let ((url (get-text-property (point) 'help-echo)))
    (if url (browse-url url)
      (error "No URL found"))))

(use-package markdown-mode
  :ensure t
  :commands gfm-mode
  :mode
  ;; use gfm mode for .md and .markdown extensions
  (("\\.\\(md\\|markdown\\)\\'" . gfm-mode)
   ;; use gfm mode for pull request and issue buffers
   ("PULLREQ_EDITMSG" . gfm-mode)
   ("ISSUE_EDITMSG" . gfm-mode)))

(provide 'init-markdown)

;;; init-markdown.el ends here