make flycheck happy
This commit is contained in:
parent
e251b74523
commit
7f99a199d2
@ -18,7 +18,7 @@ Makes use of `markdown-mode`, which already can transform markdown into html
|
|||||||
and `websocket.el` to deliver html to browser.
|
and `websocket.el` to deliver html to browser.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
*
|
||||||
`M-x markdown-preview-mode` will open preview in a browser and will start `markdown-mode` if it's not yet running for current buffer. If you've closed the preview window, you can start it over with `M-x markdown-preview-open-browser`. All websockets will be cleaned up on emacs termination. If you'd like to perform cleanup manually run `M-x markdown-preview-cleanup`.
|
`M-x markdown-preview-mode` will open preview in a browser and will start `markdown-mode` if it's not yet running for current buffer. If you've closed the preview window, you can start it over with `M-x markdown-preview-open-browser`. All websockets will be cleaned up on emacs termination. If you'd like to perform cleanup manually run `M-x markdown-preview-cleanup`.
|
||||||
|
|
||||||
## Multimarkdown
|
## Multimarkdown
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
;; Author: Igor Shymko <igor.shimko@gmail.com>
|
;; Author: Igor Shymko <igor.shimko@gmail.com>
|
||||||
;; URL: https://github.com/ancane/markdown-preview-mode
|
;; URL: https://github.com/ancane/markdown-preview-mode
|
||||||
;; Keywords: markdown, preview
|
;; Keywords: markdown, preview
|
||||||
;; Package-Requires: ((websocket "1.3") (markdown-mode "2.0") (cl-lib "0.5"))
|
;; Package-Requires: ((websocket "1.5") (markdown-mode "2.1") (cl-lib "0.5"))
|
||||||
|
|
||||||
;; This file is not part of GNU Emacs.
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
@ -22,6 +22,11 @@
|
|||||||
;; You should have received a copy of the GNU General Public License
|
;; You should have received a copy of the GNU General Public License
|
||||||
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
;;
|
||||||
|
;; This package makes use of websockets to deliver rendered markdown to a web browser.
|
||||||
|
;; Updates happen upon buffer save or on idle.
|
||||||
|
;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
@ -35,25 +40,30 @@
|
|||||||
:link '(url-link "https://github.com/ancane/markdown-preview-mode"))
|
:link '(url-link "https://github.com/ancane/markdown-preview-mode"))
|
||||||
|
|
||||||
(defcustom markdown-preview-port 7379
|
(defcustom markdown-preview-port 7379
|
||||||
"Markdown preview websocket server port"
|
"Markdown preview websocket server port."
|
||||||
:group 'markdown-preview
|
:group 'markdown-preview
|
||||||
:type 'integer)
|
:type 'integer)
|
||||||
|
|
||||||
(defcustom markdown-preview-style "http://thomasf.github.io/solarized-css/solarized-dark.min.css"
|
(defcustom markdown-preview-style "http://thomasf.github.io/solarized-css/solarized-dark.min.css"
|
||||||
"Markdown preview style URI"
|
"Markdown preview style URI."
|
||||||
:group 'markdown-preview
|
:group 'markdown-preview
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
(defvar markdown-preview--websocket-server nil
|
(defvar markdown-preview--websocket-server nil
|
||||||
"`markdown-preview' Websocket server.")
|
"`markdown-preview' Websocket server.")
|
||||||
|
|
||||||
(defvar markdown-preview--local-client nil
|
(defvar markdown-preview--local-client nil
|
||||||
"`markdown-preview' local client.")
|
"`markdown-preview' local client.")
|
||||||
|
|
||||||
(defvar markdown-preview--remote-clients nil
|
(defvar markdown-preview--remote-clients nil
|
||||||
"List of `markdown-preview' websocket remote clients.")
|
"List of `markdown-preview' websocket remote clients.")
|
||||||
|
|
||||||
(defvar markdown-preview--preview-url
|
(defvar markdown-preview--preview-url
|
||||||
(concat (file-name-directory load-file-name) "preview.html")
|
(concat (file-name-directory load-file-name) "preview.html")
|
||||||
"Location of `markdown-preview' html.")
|
"Location of `markdown-preview' html.")
|
||||||
(defvar markdown-preview--idle-timer nil "Preview idle timer")
|
|
||||||
|
(defvar markdown-preview--idle-timer nil
|
||||||
|
"Preview idle timer.")
|
||||||
|
|
||||||
(defun markdown-preview--stop-idle-timer ()
|
(defun markdown-preview--stop-idle-timer ()
|
||||||
"Stop the `markdown-preview' idle timer."
|
"Stop the `markdown-preview' idle timer."
|
||||||
@ -122,8 +132,7 @@
|
|||||||
(/
|
(/
|
||||||
(float (- (line-number-at-pos) (/ (count-screen-lines (window-start) (point)) 2)))
|
(float (- (line-number-at-pos) (/ (count-screen-lines (window-start) (point)) 2)))
|
||||||
(count-lines (point-min) (point-max))))))))
|
(count-lines (point-min) (point-max))))))))
|
||||||
(when markdown-preview-mode
|
(markdown markdown-output-buffer-name)
|
||||||
(markdown markdown-output-buffer-name))
|
|
||||||
(with-current-buffer (get-buffer markdown-output-buffer-name)
|
(with-current-buffer (get-buffer markdown-output-buffer-name)
|
||||||
(websocket-send-text websocket
|
(websocket-send-text websocket
|
||||||
(concat
|
(concat
|
||||||
@ -154,11 +163,13 @@
|
|||||||
(remove-hook 'after-save-hook 'markdown-preview--send-preview t)
|
(remove-hook 'after-save-hook 'markdown-preview--send-preview t)
|
||||||
(markdown-preview--stop-idle-timer))
|
(markdown-preview--stop-idle-timer))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun markdown-preview-open-browser ()
|
(defun markdown-preview-open-browser ()
|
||||||
"Open the `markdown-preview' in the browser."
|
"Open the `markdown-preview' in the browser."
|
||||||
(interactive)
|
(interactive)
|
||||||
(markdown-preview--open-browser-preview))
|
(markdown-preview--open-browser-preview))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun markdown-preview-cleanup ()
|
(defun markdown-preview-cleanup ()
|
||||||
"Cleanup `markdown-preview' mode."
|
"Cleanup `markdown-preview' mode."
|
||||||
(interactive)
|
(interactive)
|
||||||
@ -167,7 +178,7 @@
|
|||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-minor-mode markdown-preview-mode
|
(define-minor-mode markdown-preview-mode
|
||||||
"Markdown preview mode."
|
"Markdown preview mode."
|
||||||
:group 'markdown-preview-mode
|
:group 'markdown-preview
|
||||||
:init-value nil
|
:init-value nil
|
||||||
(when (not (or
|
(when (not (or
|
||||||
(equal major-mode 'markdown-mode)
|
(equal major-mode 'markdown-mode)
|
||||||
|
Loading…
Reference in New Issue
Block a user