This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/markdown/funcs.el

35 lines
1.2 KiB
EmacsLisp

;;; funcs.el --- Markdown Layer Functions File for Spacemacs
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun spacemacs/activate-mmm-mode ()
;; Enable `mmm-mode'.
(mmm-mode 1))
;; stolen from http://stackoverflow.com/a/26297700
;; makes markdown tables saner via orgtbl-mode
(defun spacemacs//cleanup-org-tables ()
(require 'org-table)
(save-excursion
(goto-char (point-min))
(while (search-forward "-+-" nil t) (replace-match "-|-"))))
;; Insert key for org-mode and markdown a la C-h k
;; from SE endless http://emacs.stackexchange.com/questions/2206/i-want-to-have-the-kbd-tags-for-my-blog-written-in-org-mode/2208#2208
(defun spacemacs/insert-keybinding-markdown (key)
"Ask for a key then insert its description.
Will work on both org-mode and any mode that accepts plain html."
(interactive "kType key sequence: ")
(let* ((tag "~%s~"))
(if (null (equal key "\r"))
(insert
(format tag (help-key-description key nil)))
(insert (format tag ""))
(forward-char -6))))