48 lines
1.6 KiB
EmacsLisp
48 lines
1.6 KiB
EmacsLisp
;;; init-markdown.el --- .Emacs Configuration -*- lexical-binding: t -*-
|
|
;;; Commentary:
|
|
;;
|
|
|
|
;;; Code:
|
|
(use-package markdown-mode
|
|
:pin "MELPA"
|
|
:mode (("\\.markdown\\'" . markdown-mode)
|
|
("\\.md\\'" . markdown-mode))
|
|
|
|
:config
|
|
;;----------------------------------------------------------------------------
|
|
;; Generated HTML 5 and UTF-8 with Markdown
|
|
;;----------------------------------------------------------------------------
|
|
(eval-after-load "markdown-mode"
|
|
'(defalias 'markdown-add-xhtml-header-and-footer 'as/markdown-add-xhtml-header-and-footer))
|
|
|
|
(defun as/markdown-add-xhtml-header-and-footer (title)
|
|
"Wrap XHTML header and footer with given TITLE around current buffer."
|
|
(goto-char (point-min))
|
|
(insert "<!DOCTYPE html>\n"
|
|
"<html>\n"
|
|
"<head>\n<title>")
|
|
(insert title)
|
|
(insert "</title>\n")
|
|
(insert "<meta charset=\"utf-8\" />\n")
|
|
(when (> (length markdown-css-paths) 0)
|
|
(insert (mapconcat 'markdown-stylesheet-link-string markdown-css-paths "\n")))
|
|
(insert "\n</head>\n\n"
|
|
"<body>\n\n")
|
|
(goto-char (point-max))
|
|
(insert "\n"
|
|
"</body>\n"
|
|
"</html>\n"))
|
|
|
|
;;----------------------------------------------------------------------------
|
|
;; Define custom browser
|
|
;;----------------------------------------------------------------------------
|
|
(defvar browse-url-generic-program)
|
|
(setq browse-url-generic-program "iceweasel-uxp")
|
|
(defadvice markdown-preview (around markdown-preview-in-generic activate compile)
|
|
(let ((browse-url-browser-function #'browse-url-generic))
|
|
ad-do-it)))
|
|
|
|
(provide 'init-markdown)
|
|
|
|
;;; init-markdown.el ends here
|