(deffacemarkdown-language-keyword-face'((t(:inheritfont-lock-keyword-face:family"Consolas")))"Face for langauge identifier in 'pre' text.":group'markdown-faces)(defvarmarkdown-language-keyword-face'markdown-language-keyword-face"Face for language identifier in 'pre' text.")(setqmarkdown-imenu-generic-expression'(("title""^\\(.*\\)[\n]=+$"1)("h2-""^\\(.*\\)[\n]-+$"1)("h1""^# \\(.*\\)$"1)("h2""^## \\(.*\\)$"1)("h3""^### \\(.*\\)$"1)("h4""^#### \\(.*\\)$"1)("h5""^##### \\(.*\\)$"1)("h6""^###### \\(.*\\)$"1)("fn""^\\[\\^\\(.*\\)\\]"1)))(defunmy-markdown-init()(setqimenu-generic-expressionmarkdown-imenu-generic-expression))(add-hook'markdown-mode-hook'my-markdown-init)(eval-after-load"markdown-mode"'(progn(define-keymarkdown-mode-map(kbd"S-<return>")'my-markdown-newline);; add github flavored code block fontification(font-lock-add-keywords'markdown-mode'((markdown-match-quoted-code-blocks.((0markdown-pre-facett)(1markdown-language-keyword-facett)(2markdown-pre-facett)))))))(defunmarkdown-match-quoted-code-blocks(last)"Match quoted code blocks from the point to LAST."(cond((search-forward-regexp"^\\(```\\).*$"lastt)(beginning-of-line)(let((beg(point))(end(progn(end-of-line)(point))))(forward-line)(cond((search-forward-regexp(match-string1)lastt)(set-match-data(listbeg(+beg3)(+beg3)end(1+end)(point)))t)(tnil))))(tnil)))(defunmy-markdown-newline()"If we're inside a list, jump to next line and open up a newitem. If it's a numbered list, insert the correct followingnumber."(interactive)(newline)(let(n)(if(not(save-excursion(previous-line)(beginning-of-line)(looking-at"[0-9]+")))(insert"* ")(setqn(1+(string-to-int(match-string0))))(insert(concat(int-to-stringn)". ")))))(defun-repeat(nx)"Return a list with X repeated N times.Returns nil if N is less than 1."(let(ret)(--dotimesn(!consxret))ret))(defunmy-markdown-toc()"Generate table of content from # to ####### headers."(interactive)(let((n'nil)(last-mnil)(toc""))(save-excursion(while(re-search-forward"^\\(#+\\) \\(.*\\)"nilt)(if(equallast-m(match-string1))(progn(setcarn(1+(carn))))(if(<(lengthlast-m)(length(match-string1)))(!cons1n)(!cdrn)(setcarn(1+(carn))))(setqlast-m(match-string1)))(setqtoc(concattoc(apply#'concat(-repeat(*4(1-(length(match-string1))))" "))(int-to-string(carn))". ["(match-string2)"]""(#"(replace-regexp-in-string" ""-"(downcase(match-string2)))")"))))(inserttoc)))(defunmy-markdown-generate-anchors()"Add anchors above each header. If an anchor is present,delete it and re-insert new one."(interactive)(let(m)(while(re-search-forward"^\\(#+\\) \\(.*\\)"nilt)(setqm(match-string2))(beginning-of-line)(previous-line)(if(looking-at"<a")(delete-region(point)(line-end-position))(newline))(insert(concat"<a name=\""(replace-regexp-in-string" ""-"(downcasem))"\" />"))(next-line2))))