From e6a8fbec3c88e9cdf9946e8748bb7ef2c430451a Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sat, 20 Feb 2016 14:05:02 +0100 Subject: [PATCH] update markdown-mode. --- .../markdown-mode-pkg.el | 1 - .../markdown-mode-autoloads.el | 2 +- .../markdown-mode-pkg.el | 1 + .../markdown-mode.el | 3399 ++++++++++++----- elpa/markdown-mode-readme.txt | 67 + 5 files changed, 2604 insertions(+), 866 deletions(-) delete mode 100644 elpa/markdown-mode-20150703.1903/markdown-mode-pkg.el rename elpa/{markdown-mode-20150703.1903 => markdown-mode-20160218.1732}/markdown-mode-autoloads.el (91%) create mode 100644 elpa/markdown-mode-20160218.1732/markdown-mode-pkg.el rename elpa/{markdown-mode-20150703.1903 => markdown-mode-20160218.1732}/markdown-mode.el (62%) create mode 100644 elpa/markdown-mode-readme.txt diff --git a/elpa/markdown-mode-20150703.1903/markdown-mode-pkg.el b/elpa/markdown-mode-20150703.1903/markdown-mode-pkg.el deleted file mode 100644 index b777e46e..00000000 --- a/elpa/markdown-mode-20150703.1903/markdown-mode-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "markdown-mode" "20150703.1903" "Emacs Major mode for Markdown-formatted text files" 'nil :url "http://jblevins.org/projects/markdown-mode/" :keywords '("markdown" "github flavored markdown" "itex")) diff --git a/elpa/markdown-mode-20150703.1903/markdown-mode-autoloads.el b/elpa/markdown-mode-20160218.1732/markdown-mode-autoloads.el similarity index 91% rename from elpa/markdown-mode-20150703.1903/markdown-mode-autoloads.el rename to elpa/markdown-mode-20160218.1732/markdown-mode-autoloads.el index 227ef9b5..6463b5df 100644 --- a/elpa/markdown-mode-20150703.1903/markdown-mode-autoloads.el +++ b/elpa/markdown-mode-20160218.1732/markdown-mode-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "markdown-mode" "markdown-mode.el" (21913 4078 +;;;### (autoloads nil "markdown-mode" "markdown-mode.el" (22215 9032 ;;;;;; 0 0)) ;;; Generated autoloads from markdown-mode.el diff --git a/elpa/markdown-mode-20160218.1732/markdown-mode-pkg.el b/elpa/markdown-mode-20160218.1732/markdown-mode-pkg.el new file mode 100644 index 00000000..677e3e63 --- /dev/null +++ b/elpa/markdown-mode-20160218.1732/markdown-mode-pkg.el @@ -0,0 +1 @@ +(define-package "markdown-mode" "20160218.1732" "Emacs Major mode for Markdown-formatted text files" '((cl-lib "0.5")) :url "http://jblevins.org/projects/markdown-mode/" :keywords '("markdown" "github flavored markdown" "itex")) diff --git a/elpa/markdown-mode-20150703.1903/markdown-mode.el b/elpa/markdown-mode-20160218.1732/markdown-mode.el similarity index 62% rename from elpa/markdown-mode-20150703.1903/markdown-mode.el rename to elpa/markdown-mode-20160218.1732/markdown-mode.el index b5365008..437de952 100644 --- a/elpa/markdown-mode-20150703.1903/markdown-mode.el +++ b/elpa/markdown-mode-20160218.1732/markdown-mode.el @@ -1,6 +1,6 @@ -;;; markdown-mode.el --- Emacs Major mode for Markdown-formatted text files +;;; markdown-mode.el --- Emacs Major mode for Markdown-formatted text files -*- lexical-binding: t; -*- -;; Copyright (C) 2007-2015 Jason R. Blevins +;; Copyright (C) 2007-2016 Jason R. Blevins ;; Copyright (C) 2007, 2009 Edward O'Connor ;; Copyright (C) 2007 Conal Elliott ;; Copyright (C) 2008 Greg Bognar @@ -24,12 +24,16 @@ ;; Copyright (C) 2013 Matus Goljer ;; Copyright (C) 2015 Google, Inc. (Contributor: Samuel Freilich ) ;; Copyright (C) 2015 Antonis Kanouras +;; Copyright (C) 2015 Howard Melman +;; Copyright (C) 2015-2016 Danny McClanahan +;; Copyright (C) 2015-2016 Syohei Yoshida ;; Author: Jason R. Blevins ;; Maintainer: Jason R. Blevins ;; Created: May 24, 2007 -;; Version: 2.0 -;; Package-Version: 20150703.1903 +;; Version: 2.1 +;; Package-Version: 20160218.1732 +;; Package-Requires: ((cl-lib "0.5")) ;; Keywords: Markdown, GitHub Flavored Markdown, itex ;; URL: http://jblevins.org/projects/markdown-mode/ @@ -58,48 +62,47 @@ ;; ;; [Markdown]: http://daringfireball.net/projects/markdown/ ;; -;; The latest stable version is markdown-mode 2.0, released on March 24, 2013: +;; The latest stable version is markdown-mode 2.1, released on January 9, 2016: ;; ;; * [markdown-mode.el][] ;; * [Screenshot][][^theme] ;; * [Release notes][] ;; ;; [markdown-mode.el]: http://jblevins.org/projects/markdown-mode/markdown-mode.el -;; [Screenshot]: http://jblevins.org/projects/markdown-mode/screenshots/20130131-002.png -;; [Release notes]: http://jblevins.org/projects/markdown-mode/rev-2-0 +;; [Screenshot]: http://jblevins.org/projects/markdown-mode/screenshots/20160108-001.png +;; [Release notes]: http://jblevins.org/projects/markdown-mode/rev-2-1 ;; ;; [^theme]: The theme used in the screenshot is ;; [color-theme-twilight](https://github.com/crafterm/twilight-emacs). ;; +;; The latest development version can be obtained from the Git +;; repository at or from +;; [GitHub][]: +;; +;; git clone git://jblevins.org/git/markdown-mode.git +;; git clone https://github.com/jrblevin/markdown-mode.git +;; +;; [devel.el]: http://jblevins.org/git/markdown-mode.git/plain/markdown-mode.el +;; [GitHub]: https://github.com/jrblevin/markdown-mode/ +;; ;; markdown-mode is also available in several package managers, including: ;; -;; * Debian Linux: [emacs-goodies-el][] -;; * Ubuntu Linux: [emacs-goodies-el][emacs-goodies-el-ubuntu] +;; * Debian Linux: [elpa-markdown-mode][] and [emacs-goodies-el][] +;; * Ubuntu Linux: [elpa-markdown-mode][elpa-ubuntu] and [emacs-goodies-el][emacs-goodies-el-ubuntu] ;; * RedHat and Fedora Linux: [emacs-goodies][] ;; * NetBSD: [textproc/markdown-mode][] -;; * Arch Linux (AUR): [emacs-markdown-mode-git][] ;; * MacPorts: [markdown-mode.el][macports-package] ([pending][macports-ticket]) ;; * FreeBSD: [textproc/markdown-mode.el][freebsd-port] ;; +;; [elpa-markdown-mode]: https://packages.debian.org/sid/lisp/elpa-markdown-mode +;; [elpa-ubuntu]: http://packages.ubuntu.com/search?keywords=elpa-markdown-mode ;; [emacs-goodies-el]: http://packages.debian.org/emacs-goodies-el ;; [emacs-goodies-el-ubuntu]: http://packages.ubuntu.com/search?keywords=emacs-goodies-el ;; [emacs-goodies]: https://apps.fedoraproject.org/packages/emacs-goodies ;; [textproc/markdown-mode]: http://pkgsrc.se/textproc/markdown-mode -;; [emacs-markdown-mode-git]: https://aur.archlinux.org/packages/emacs-goodies-el/ ;; [macports-package]: https://trac.macports.org/browser/trunk/dports/editors/markdown-mode.el/Portfile ;; [macports-ticket]: http://trac.macports.org/ticket/35716 ;; [freebsd-port]: http://svnweb.freebsd.org/ports/head/textproc/markdown-mode.el -;; -;; The latest development version can be downloaded directly -;; ([markdown-mode.el][devel.el]) or it can be obtained from the -;; (browsable and clonable) Git repository at -;; . The entire repository, -;; including the full project history, can be cloned via the Git protocol -;; by running -;; -;; git clone git://jblevins.org/git/markdown-mode.git -;; -;; [devel.el]: http://jblevins.org/git/markdown-mode.git/plain/markdown-mode.el ;;; Installation: @@ -116,6 +119,10 @@ ;; There is no official Markdown file extension, nor is there even a ;; _de facto_ standard, so you can easily add, change, or remove any ;; of the file extensions above as needed. +;; +;; `markdown-mode' depends on `cl-lib', which has been bundled with +;; GNU Emacs since 24.3. Users of GNU Emacs 24.1 and 24.2 can install +;; `cl-lib' with `package.el'. ;;; Usage: @@ -197,8 +204,9 @@ ;; the word italic. If the point is at an italic word or phrase, ;; remove the italic markup. Otherwise, simply insert italic ;; delimiters and place the cursor in between them. Similarly, -;; use `C-c C-s s` for bold (``) and `C-c C-s c` for -;; inline code (``). +;; use `C-c C-s s` for bold (``), `C-c C-s c` for +;; inline code (``), and `C-c C-s k` for inserting `` +;; tags. ;; ;; `C-c C-s b` inserts a blockquote using the active region, if any, ;; or starts a new blockquote. `C-c C-s C-b` is a variation which @@ -257,10 +265,14 @@ ;; and save the result in the file `basename.html`, where ;; `basename` is the name of the Markdown file with the extension ;; removed. *Export and View:* press `C-c C-c v` to export the -;; file and view it in a browser. **For both export commands, the -;; output file will be overwritten without notice.** -;; *Open:* `C-c C-c o` will open the Markdown source file directly -;; using `markdown-open-command'. +;; file and view it in a browser. *Open:* `C-c C-c o` will open +;; the Markdown source file directly using `markdown-open-command'. +;; *Live Export*: Press `C-c C-c l` to turn on +;; `markdown-live-preview-mode' to view the exported output +;; side-by-side with the source Markdown. **For all export commands, +;; the output file will be overwritten without notice.** +;; `markdown-live-preview-window-function' can be customized to open +;; in a browser other than `eww'. ;; ;; To summarize: ;; @@ -270,6 +282,7 @@ ;; - `C-c C-c v`: `markdown-command' > `basename.html` > browser. ;; - `C-c C-c w`: `markdown-command' > kill ring. ;; - `C-c C-c o`: `markdown-open-command'. +;; - `C-c C-c l`: `markdown-live-preview-mode' > `*eww*` buffer. ;; ;; `C-c C-c c` will check for undefined references. If there are ;; any, a small buffer will open with a list of undefined @@ -293,9 +306,9 @@ ;; or in the other window with the `C-u` prefix). Use `M-p` and ;; `M-n` to quickly jump to the previous or next link of any type. ;; -;; * Jumping: `C-c C-j` +;; * Jumping: `C-c C-l` ;; -;; Use `C-c C-j` to jump from the object at point to its counterpart +;; Use `C-c C-l` to jump from the object at point to its counterpart ;; elsewhere in the text, when possible. Jumps between reference ;; links and definitions; between footnote markers and footnote ;; text. If more than one link uses the same reference name, a @@ -334,8 +347,8 @@ ;; ;; * Editing Lists: `M-RET`, `M-UP`, `M-DOWN`, `M-LEFT`, and `M-RIGHT` ;; -;; New list items can be inserted with `M-RET`. This command -;; determines the appropriate marker (one of the possible +;; New list items can be inserted with `M-RET` or `C-c C-j`. This +;; command determines the appropriate marker (one of the possible ;; unordered list markers or the next number in sequence for an ;; ordered list) and indentation level by examining nearby list ;; items. If there is no list before or after the point, start a @@ -346,6 +359,20 @@ ;; Existing list items can be moved up or down with `M-UP` or ;; `M-DOWN` and indented or exdented with `M-RIGHT` or `M-LEFT`. ;; +;; * Editing Subtrees: `M-S-UP`, `M-S-DOWN`, `M-S-LEFT`, and `M-S-RIGHT` +;; +;; Entire subtrees of ATX headings can be promoted and demoted +;; with `M-S-LEFT` and `M-S-RIGHT`, which mirror the bindings +;; for promotion and demotion of list items. Similarly, subtrees +;; can be moved up and down with `M-S-UP` and `M-S-DOWN`. +;; +;; Please note the following "boundary" behavior for promotion and +;; demotion. Any level-six headings will not be demoted further +;; (i.e., they remain at level six, since Markdown and HTML define +;; only six levels) and any level-one headings will promoted away +;; entirely (i.e., heading markup will be removed, since a +;; level-zero heading is not defined). +;; ;; * Shifting the Region: `C-c <` and `C-c >` ;; ;; Text in the region can be indented or exdented as a group using @@ -471,10 +498,19 @@ ;; demotion, keep these sorted from largest to smallest. ;; ;; * `markdown-bold-underscore' - set to a non-nil value to use two -;; underscores for bold instead of two asterisks (default: `nil'). +;; underscores when inserting bold text instead of two asterisks +;; (default: `nil'). ;; ;; * `markdown-italic-underscore' - set to a non-nil value to use -;; underscores for italic instead of asterisks (default: `nil'). +;; underscores when inserting italic text instead of asterisks +;; (default: `nil'). +;; +;; * `markdown-asymmetric-header' - set to a non-nil value to use +;; asymmetric header styling, placing header characters only on +;; the left of headers (default: `nil'). +;; +;; * `markdown-list-indent-width' - depth of indentation for lists +;; when inserting, promoting, and demoting list items (default: 4). ;; ;; * `markdown-indent-function' - the function to use for automatic ;; indentation (default: `markdown-indent-line'). @@ -540,6 +576,12 @@ ;; (default: `end`). The set of location options is the same as ;; for `markdown-reference-location'. ;; +;; * `markdown-nested-imenu-heading-index' - Use nested imenu +;; heading instead of a flat index (default: `nil'). A nested +;; index may provide more natural browsing from the menu, but a +;; flat list may allow for faster keyboard navigation via tab +;; completion. +;; ;; * `comment-auto-fill-only-comments' - variable is made ;; buffer-local and set to `nil' by default. In programming ;; language modes, when this variable is non-nil, only comments @@ -549,6 +591,23 @@ ;; this variable buffer-local allows `markdown-mode' to override ;; the default behavior induced when the global variable is non-nil. ;; +;; * `markdown-gfm-additional-languages', - additional languages to +;; make available, aside from those predefined in +;; `markdown-gfm-recognized-languages', when inserting GFM code +;; blocks (default: `nil`). Language strings must have be trimmed +;; of whitespace and not contain any curly braces. They may be of +;; arbitrary capitalization, though. +;; +;; * `markdown-gfm-use-electric-backquote' - use +;; `markdown-electric-backquote' for interactive insertion of GFM +;; code blocks when backquote is pressed three times (default: `t`). +;; +;; * `markdown-make-gfm-checkboxes-buttons' - Whether GitHub +;; Flavored Markdown style task lists (checkboxes) should be +;; turned into buttons that can be toggled with mouse-1 or RET. If +;; non-nil (default), then buttons are enabled. This works in +;; `markdown-mode' as well as `gfm-mode'. +;; ;; Additionally, the faces used for syntax highlighting can be modified to ;; your liking by issuing `M-x customize-group RET markdown-faces` ;; or by using the "Markdown Faces" link at the bottom of the mode @@ -566,7 +625,12 @@ ;; Aliased or piped wiki links of the form `[[link text|PageName]]` ;; are also supported. Since some wikis reverse these components, set ;; `markdown-wiki-link-alias-first' to nil to treat them as -;; `[[PageName|link text]]`. +;; `[[PageName|link text]]`. By default, Markdown Mode only searches +;; for target files in the current directory. Sequential parent +;; directory search (as in [Ikiwiki][]) can be enabled by setting +;; `markdown-wiki-link-search-parent-directories' to a non-nil value. +;; +;; [Ikiwiki]: https://ikiwiki.info ;; ;; [SmartyPants][] support is possible by customizing `markdown-command'. ;; If you install `SmartyPants.pl` at, say, `/usr/local/bin/smartypants`, @@ -574,10 +638,7 @@ ;; You can do this either by using `M-x customize-group markdown` ;; or by placing the following in your `.emacs` file: ;; -;; (defun markdown-custom () -;; "markdown-mode-hook" -;; (setq markdown-command "markdown | smartypants")) -;; (add-hook 'markdown-mode-hook '(lambda() (markdown-custom))) +;; (setq markdown-command "markdown | smartypants") ;; ;; [SmartyPants]: http://daringfireball.net/projects/smartypants/ ;; @@ -588,39 +649,82 @@ ;; in `.emacs`, and then restarting Emacs or calling ;; `markdown-reload-extensions'. -;;; GitHub Flavored Markdown: - -;; A [GitHub Flavored Markdown][GFM] (GFM) mode, `gfm-mode', is also -;; available. The GitHub implementation of differs slightly from -;; standard Markdown. The most important differences are that -;; newlines are significant, triggering hard line breaks, and that -;; underscores inside of words (e.g., variable names) need not be -;; escaped. As such, `gfm-mode' turns off `auto-fill-mode' and turns -;; on `visual-line-mode' (or `longlines-mode' if `visual-line-mode' is -;; not available). Underscores inside of words (such as -;; test_variable) will not trigger emphasis. +;;; GitHub Flavored Markdown (GFM): + +;; A [GitHub Flavored Markdown][GFM] mode, `gfm-mode', is also +;; available. The GitHub implementation differs slightly from +;; standard Markdown in that it supports things like different +;; behavior for underscores inside of words, automatic linking of +;; URLs, strikethrough text, and fenced code blocks with an optional +;; language keyword. +;; +;; The GFM-specific features above apply to `README.md` files, wiki +;; pages, and other Markdown-formatted files in repositories on +;; GitHub. GitHub also enables [additional features][GFM comments] for +;; writing on the site (for issues, pull requests, messages, etc.) +;; that are further extensions of GFM. These features include task +;; lists (checkboxes), newlines corresponding to hard line breaks, +;; auto-linked references to issues and commits, wiki links, and so +;; on. To make matters more confusing, although task lists are not +;; part of [GFM proper][GFM], [since 2014][] they are rendered (in a +;; read-only fashion) in all Markdown documents in repositories on the +;; site. These additional extensions are supported to varying degrees +;; by `markdown-mode' and `gfm-mode' as described below. ;; -;; Wiki links in this mode will be treated as on GitHub, with hyphens -;; replacing spaces in filenames and where the first letter of the -;; filename capitalized. For example, `[[wiki link]]' will map to a -;; file named `Wiki-link` with the same extension as the current file. +;; * **URL autolinking:** Both `markdown-mode' and `gfm-mode' support +;; highlighting of URLs without angle brackets. ;; -;; GFM code blocks, with optional programming language keywords, will -;; be highlighted. They can be inserted with `C-c C-s P`. If there -;; is an active region, the text in the region will be placed inside -;; the code block. You will be prompted for the name of the language, -;; but may press enter to continue without naming a language. +;; * **Multiple underscores in words:** You must enable `gfm-mode' to +;; toggle support for underscores inside of words. In this mode +;; variable names such as `a_test_variable` will not trigger +;; emphasis (italics). ;; -;; Similarly, strike through text is supoorted in GFM mode and can be -;; inserted (and toggled) using `C-c C-s d`. Following the mnemonics -;; for the other style keybindings, the letter `d` coincides with the -;; HTML tag ``. +;; * **Fenced code blocks:** Code blocks quoted with backticks, with +;; optional programming language keywords, are highlighted in +;; both `markdown-mode' and `gfm-mode'. They can be inserted with +;; `C-c C-s P`. If there is an active region, the text in the +;; region will be placed inside the code block. You will be +;; prompted for the name of the language, but may press enter to +;; continue without naming a language. ;; -;; For GFM preview can be powered by setting `markdown-command' to -;; use [Docter][]. This may also be configured to work with [Marked 2][] -;; for `markdown-open-command'. +;; * **Strikethrough:** Strikethrough text is only supported in +;; `gfm-mode' and can be inserted (and toggled) using `C-c C-s d`. +;; Following the mnemonics for the other style keybindings, the +;; letter `d` coincides with the HTML tag ``. +;; +;; * **Task lists:** GFM task lists will be rendered as checkboxes +;; (Emacs buttons) in both `markdown-mode' and `gfm-mode' when +;; `markdown-make-gfm-checkboxes-buttons' is set to a non-nil value +;; (and it is set to t by default). These checkboxes can be +;; toggled by clicking `mouse-1` or pressing `RET` over the button. +;; +;; * **Wiki links:** Generic wiki links are supported in +;; `markdown-mode', but in `gfm-mode' specifically they will be +;; treated as they are on GitHub: spaces will be replaced by hyphens +;; in filenames and the first letter of the filename will be +;; capitalized. For example, `[[wiki link]]' will map to a file +;; named `Wiki-link` with the same extension as the current file. +;; +;; * **Newlines:** Neither `markdown-mode' nor `gfm-mode' do anything +;; specifically with respect to newline behavior. If you use +;; `gfm-mode' mostly to write text for comments or issues on the +;; GitHub site--where newlines are significant and correspond to +;; hard line breaks--then you may want to enable `visual-line-mode' +;; for line wrapping in buffers. You can do this with a +;; `gfm-mode-hook' as follows: +;; +;; ;; Use visual-line-mode in gfm-mode +;; (defun my-gfm-mode-hook () +;; (visual-line-mode 1)) +;; (add-hook 'gfm-mode-hook 'my-gfm-mode-hook) +;; +;; * **Preview:** GFM-specific preview can be powered by setting +;; `markdown-command' to use [Docter][]. This may also be +;; configured to work with [Marked 2][] for `markdown-open-command'. ;; ;; [GFM]: http://github.github.com/github-flavored-markdown/ +;; [GFM comments]: https://help.github.com/articles/writing-on-github/ +;; [since 2014]: https://github.com/blog/1825-task-lists-in-all-markdown-documents ;; [Docter]: https://github.com/alampros/Docter ;;; Acknowledgments: @@ -704,7 +808,7 @@ ;; behavior regarding list items, footnotes, and reference ;; definitions, improved killing of footnotes, and numerous other ;; tests and bug fixes. -;; * Antonis Kanouras for strike through support. +;; * Antonis Kanouras for strikethrough support. ;; * Tim Visher for multiple CSS files and other ;; general improvements. ;; * Matt McClure for a patch to prevent @@ -712,15 +816,22 @@ ;; * Roger Bolsius for ordered list improvements. ;; * Google's Open Source Programs Office for recognizing the project with ;; a monetary contribution in June 2015. +;; * Howard Melman for supporting GFM checkboxes +;; as buttons. +;; * Danny McClanahan for live preview mode, +;; completion of GFM programming language names, and `cl-lib' updates. +;; * Syohei Yoshida for better heading detection +;; and movement functions, improved italic font lock, and fixing adaptive +;; filling for hanging list items. ;;; Bugs: -;; Although markdown-mode is developed and tested primarily using -;; GNU Emacs 24, compatibility with earlier Emacsen is also a -;; priority. +;; markdown-mode is developed and tested primarily for compatibility +;; with GNU Emacs 24.3 and later. If you find any bugs in +;; markdown-mode, please construct a test case or a patch and open a +;; ticket on the [GitHub issue tracker][issues]. ;; -;; If you find any bugs in markdown-mode, please construct a test case -;; or a patch and email me at . +;; [issues]: https://github.com/jrblevin/markdown-mode/issues ;;; History: @@ -738,6 +849,7 @@ ;; * 2011-08-15: [Version 1.8.1][] ;; * 2013-01-25: [Version 1.9][] ;; * 2013-03-24: [Version 2.0][] +;; * 2016-01-09: [Version 2.1][] ;; ;; [Version 1.3]: http://jblevins.org/projects/markdown-mode/rev-1-3 ;; [Version 1.5]: http://jblevins.org/projects/markdown-mode/rev-1-5 @@ -747,6 +859,7 @@ ;; [Version 1.8.1]: http://jblevins.org/projects/markdown-mode/rev-1-8-1 ;; [Version 1.9]: http://jblevins.org/projects/markdown-mode/rev-1-9 ;; [Version 2.0]: http://jblevins.org/projects/markdown-mode/rev-2-0 +;; [Version 2.1]: http://jblevins.org/projects/markdown-mode/rev-2-1 ;;; Code: @@ -754,12 +867,17 @@ (require 'easymenu) (require 'outline) (require 'thingatpt) -(eval-when-compile (require 'cl)) +(require 'cl-lib) + +(defvar jit-lock-start) +(defvar jit-lock-end) + +(declare-function eww-open-file "eww") ;;; Constants ================================================================= -(defconst markdown-mode-version "2.0" +(defconst markdown-mode-version "2.1" "Markdown mode version number.") (defconst markdown-output-buffer-name "*markdown-output*" @@ -771,6 +889,12 @@ (defvar markdown-reference-label-history nil "History of used reference labels.") +(defvar markdown-live-preview-mode nil + "Sentinel variable for `markdown-live-preview-mode'.") + +(defvar markdown-gfm-language-history nil + "History list of languages used in the current buffer in GFM code blocks.") + ;;; Customizable Variables ==================================================== @@ -829,12 +953,20 @@ promotion and demotion functions." :type 'list) (defcustom markdown-bold-underscore nil - "Use two underscores for bold instead of two asterisks." + "Use two underscores when inserting bold text instead of two asterisks." :group 'markdown :type 'boolean) (defcustom markdown-italic-underscore nil - "Use underscores for italic instead of asterisks." + "Use underscores when inserting italic text instead of asterisks." + :group 'markdown + :type 'boolean) + +(defcustom markdown-asymmetric-header nil + "Determines if header style will be asymmetric. +Set to non-nil to only have header characters to the left of the title. +The default will ensure header characters are placed to the left and right +of the title." :group 'markdown :type 'boolean) @@ -856,7 +988,15 @@ auto-indentation by pressing \\[newline-and-indent]." "When non-nil, treat aliased wiki links like [[alias text|PageName]]. Otherwise, they will be treated as [[PageName|alias text]]." :group 'markdown - :type 'boolean) + :type 'boolean + :safe 'booleanp) + +(defcustom markdown-wiki-link-search-parent-directories nil + "When non-nil, search for wiki link targets in parent directories. +This is the default search behavior of Ikiwiki." + :group 'markdown + :type 'boolean + :safe 'booleanp) (defcustom markdown-uri-types '("acap" "cid" "data" "dav" "fax" "file" "ftp" "gopher" "http" "https" @@ -930,6 +1070,858 @@ and `iso-latin-1'. Use `list-coding-systems' for more choices." :group 'markdown :type 'string) +(defcustom markdown-nested-imenu-heading-index nil + "Use nested or flat imenu heading index. +A nested index may provide more natural browsing from the menu, +but a flat list may allow for faster keyboard navigation via tab +completion." + :group 'markdown + :type 'boolean) + +(defcustom markdown-make-gfm-checkboxes-buttons t + "When non-nil, make GFM checkboxes into buttons." + :group 'markdown + :type 'boolean) + +(defcustom markdown-use-pandoc-style-yaml-metadata nil + "When non-nil, allow yaml metadata anywhere in the document, and allow +ellipses to close a metadata region." + :group 'markdown + :type 'boolean) + +(defcustom markdown-live-preview-window-function + 'markdown-live-preview-window-eww + "Function to display preview of Markdown output within Emacs. Function must +update the buffer containing the preview and return the buffer." + :group 'markdown + :type 'function) + +(defcustom markdown-live-preview-delete-export 'delete-on-destroy + "Delete exported html file when using `markdown-live-preview-export' on every +export by setting to 'delete-on-export, when quitting +`markdown-live-preview-mode' by setting to 'delete-on-destroy, or not at all +when nil." + :group 'markdown + :type 'symbol) + +(defcustom markdown-list-indent-width 4 + "Depth of indentation for markdown lists. Used in `markdown-demote-list-item' +and `markdown-promote-list-item'." + :group 'markdown + :type 'integer) + +(defcustom markdown-gfm-additional-languages nil + "Additional languages to make available when inserting GFM code +blocks. Language strings must have be trimmed of whitespace and not contain any +curly braces. They may be of arbitrary capitalization, though." + :group 'markdown + :type '(repeat (string :validate markdown-validate-language-string))) + +(defcustom markdown-gfm-use-electric-backquote t + "Use `markdown-electric-backquote' when backquote is hit three times." + :group 'markdown + :type 'boolean) + +(defcustom markdown-gfm-downcase-languages t + "Downcase suggested languages when inserting them to code blocks with +`markdown-electric-backquote'." + :group 'markdown + :type 'boolean) + + +;;; Regular Expressions ======================================================= + +(defconst markdown-regex-comment-start + "