Skip to content

Instantly share code, notes, and snippets.

@emasaka
Created April 23, 2016 13:30
Show Gist options
  • Save emasaka/8139d58c89d9ade0639994be4dfa3698 to your computer and use it in GitHub Desktop.
Save emasaka/8139d58c89d9ade0639994be4dfa3698 to your computer and use it in GitHub Desktop.
hide code blocks in Markdown by outline.el
;; md-hide-codes.el:
;; hide code blocks in Markdown by outline.el
(require 'outline)
(defun md-hide-codes ()
"hide code blocks in Markdown"
(interactive)
(save-excursion
(goto-char (point-min))
(let ((start-point nil))
(while (re-search-forward "^```" nil t)
(if (null start-point)
(setq start-point (point))
(outline-flag-region start-point (match-beginning 0) t)
(setq start-point nil) )))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment