Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add imenu support to markdown files

  • Loading branch information...
commit fb5422bc41e23b30d765af39e4be447dd82d4624 1 parent 97b4cb5
@magnars magnars authored
Showing with 18 additions and 0 deletions.
  1. +1 −0  init.el
  2. +17 −0 setup-markdown-mode.el
View
1  init.el
@@ -94,6 +94,7 @@
(eval-after-load 'js2-mode '(require 'setup-js2-mode))
(eval-after-load 'ruby-mode '(require 'setup-ruby-mode))
(eval-after-load 'clojure-mode '(require 'setup-clojure-mode))
+(eval-after-load 'markdown-mode '(require 'setup-markdown-mode))
;; Load slime-js when asked for
(autoload 'slime-js-jack-in-browser "setup-slime-js" nil t)
View
17 setup-markdown-mode.el
@@ -0,0 +1,17 @@
+(setq markdown-imenu-generic-expression
+ '(("title" "^\\(.*\\)[\n]=+$" 1)
+ ("h2-" "^\\(.*\\)[\n]-+$" 1)
+ ("h1" "^# \\(.*\\)$" 1)
+ ("h2" "^## \\(.*\\)$" 1)
+ ("h3" "^### \\(.*\\)$" 1)
+ ("h4" "^#### \\(.*\\)$" 1)
+ ("h5" "^##### \\(.*\\)$" 1)
+ ("h6" "^###### \\(.*\\)$" 1)
+ ("fn" "^\\[\\^\\(.*\\)\\]" 1)
+ ))
+
+(add-hook 'markdown-mode-hook
+ (lambda ()
+ (setq imenu-generic-expression markdown-imenu-generic-expression)))
+
+(provide 'setup-markdown-mode)
Please sign in to comment.
Something went wrong with that request. Please try again.