Permalink
Browse files

GFM code blocks without language keywords

  • Loading branch information...
1 parent b664a7b commit 15b41ba0c656ea831d09b219afc915702ea73e95 @jrblevin jrblevin committed Jul 8, 2013
Showing with 9 additions and 2 deletions.
  1. +2 −2 markdown-mode.el
  2. +7 −0 tests/markdown-test.el
View
@@ -1870,7 +1870,7 @@ because `thing-at-point-looking-at' does not work reliably with
"Match GFM quoted code blocks from point to LAST."
(let (open lang body close all)
(cond ((and (eq major-mode 'gfm-mode)
- (search-forward-regexp "^\\(```\\)\\(\\w+\\)?$" last t))
+ (search-forward-regexp "^\\(```\\)\\([^[:space:]]+[[:space:]]*\\)?$" last t))
(beginning-of-line)
(setq open (list (match-beginning 1) (match-end 1))
lang (list (match-beginning 2) (match-end 2)))
@@ -4653,7 +4653,7 @@ if ARG is omitted or nil."
;; GFM features to match first
(list
(cons 'markdown-match-gfm-code-blocks '((1 markdown-pre-face)
- (2 markdown-language-keyword-face)
+ (2 markdown-language-keyword-face t t)
(3 markdown-pre-face)
(4 markdown-pre-face))))
;; Basic Markdown features (excluding possibly overridden ones)
View
@@ -2334,6 +2334,13 @@ See `paragraph-separate'."
(markdown-test-range-has-face 2647 2728 markdown-pre-face) ; code
(markdown-test-range-has-face 2730 2732 markdown-pre-face))) ; ```
+(ert-deftest test-markdown-gfm/code-block-font-lock-2 ()
+ "GFM code block font lock test without language identifier."
+ (markdown-test-string-gfm "Plain code block:\n\n```\nfoo\n```\n"
+ (markdown-test-range-has-face 20 22 markdown-pre-face)
+ (markdown-test-range-has-face 24 26 markdown-pre-face)
+ (markdown-test-range-has-face 28 30 markdown-pre-face)))
+
(provide 'markdown-test)
;;; markdown-test.el ends here

0 comments on commit 15b41ba

Please sign in to comment.