Variable: rst-font-lock-keywords
rst-font-lock-keywords is a variable defined in rst.el.gz.
Value
Large value
(("^[ ]*\\([-*+•‣⁃]\\(?:[ ]+\\|$\\)\\)" 1 'rst-block)
("^[ ]*\\(\\(?:\\(?:[a-zA-Z]\\|[0-9]+\\|[IVXLCDMivxlcdm]+\\|#\\)\\.\\|(?\\(?:[a-zA-Z]\\|[0-9]+\\|[IVXLCDMivxlcdm]+\\|#\\))\\)\\(?:[ ]+\\|$\\)\\)" 1 'rst-block)
("^[ ]*\\(:\\(?:[^:\n]\\|\\\\:\\)+:\\)\\(?:[ ]+\\|$\\)" 1 'rst-external)
("^[ ]*\\(\\(?:\\(?:[+/-]\\|--\\)\\sw\\(?:-\\|\\sw\\)*\\(?:[ =]\\S +\\)?\\)\\(?:\\(?:,[ ]\\)\\(?:\\(?:[+/-]\\|--\\)\\sw\\(?:-\\|\\sw\\)*\\(?:[ =]\\S +\\)?\\)\\)*\\)\\(?:$\\|[ ]\\{2\\}\\)" 1 'rst-block)
("^[ ]*\\(|\\(?:[ ]+\\|$\\)\\)[^|\n]*$" 1 'rst-block)
("^[ ]*\\(\\.\\.[ ]+\\)\\(\\[[^]\n]+]\\)\\(?:[ ]+\\|$\\)"
(1 'rst-definition)
(2 'rst-definition))
("^[ ]*\\(\\.\\.[ ]+\\)\\(\\(?:|\\(?:\\S \\|\\S \\(?:[^|\\\n]\\|\\\\.\\)\\{0,1000\\}[^ |\\]\\)|[ ]+\\)?\\)\\(\\(?:\\sw+\\(?:[+.:_-]\\sw+\\)*\\)::\\)\\(?:[ ]+\\|$\\)"
(1 'rst-directive)
(2 'rst-definition)
(3 'rst-directive))
("^[ ]*\\(\\.\\.[ ]+_\\(?:`\\(?:\\S \\|\\S \\(?:[^`\\\n]\\|\\\\.\\)\\{0,1000\\}[^ `\\]\\)`\\|\\(?:[^:\\\n]\\|\\\\.\\)+\\):\\)\\(?:[ ]+\\|$\\)" 1 'rst-definition)
("^[ ]*\\(__\\)\\(?:[ ]+\\|$\\)" 1 'rst-definition)
("\\(?:^\\|[ ]\\|['\"([{<‘“«’/:-]\\)\\(\\*\\*\\(?:\\S \\|\\S \\(?:[^*\\]\\|\\\\.\\)\\{0,1000\\}[^ *\\]\\)\\*\\*\\)\\(?:$\\|[ ]\\|[]'\")}>’”»/:.,;!?\\-]\\)" 1 'rst-emphasis2)
("\\(?:^\\|[ ]\\|['\"([{<‘“«’/:-]\\)\\(\\*\\(?:\\S \\|\\S \\(?:[^*\\]\\|\\\\.\\)\\{0,1000\\}[^ *\\]\\)\\*\\)\\(?:$\\|[ ]\\|[]'\")}>’”»/:.,;!?\\-]\\)" 1 'rst-emphasis1)
("\\(?:^\\|[ ]\\|['\"([{<‘“«’/:-]\\)\\(``\\(?:\\S \\|\\S \\(?:[^`\\]\\|\\\\.\\)\\{0,1000\\}[^ `\\]\\)``\\)\\(?:$\\|[ ]\\|[]'\")}>’”»/:.,;!?\\-]\\)" 1 'rst-literal)
("\\(?:^\\|[ ]\\|['\"([{<‘“«’/:-]\\)\\(_`\\(?:\\S \\|\\S \\(?:[^`\\]\\|\\\\.\\)\\{0,1000\\}[^ `\\]\\)`\\)\\(?:$\\|[ ]\\|[]'\")}>’”»/:.,;!?\\-]\\)" 1 'rst-definition)
("\\(?:^\\|[ ]\\|['\"([{<‘“«’/:-]\\)\\(\\(?:`\\(?:\\S \\|\\S \\(?:[^`\\]\\|\\\\.\\)\\{0,1000\\}[^ `\\]\\)`\\|\\sw\\(?:\\sw\\|-\\)+\\sw\\)__?\\)\\(?:$\\|[ ]\\|[]'\")}>’”»/:.,;!?\\-]\\)" 1 'rst-reference)
("\\(?:^\\|[ ]\\|['\"([{<‘“«’/:-]\\)\\(\\(?::\\(?:\\sw+\\(?:[+.:_-]\\sw+\\)*\\):\\)?\\)\\(`\\(?:\\S \\|\\S \\(?:[^`\\]\\|\\\\.\\)\\{0,1000\\}[^ `\\]\\)`\\)\\(\\(?::\\(?:\\sw+\\(?:[+.:_-]\\sw+\\)*\\):\\)?\\)\\(?:$\\|[ ]\\|[]'\")}>’”»/:.,;!?\\-]\\)"
(1 'rst-directive)
(2 'rst-external)
(3 'rst-directive))
("\\(?:^\\|[ ]\\|['\"([{<‘“«’/:-]\\)\\(\\[[^]\n]+]_\\)\\(?:$\\|[ ]\\|[]'\")}>’”»/:.,;!?\\-]\\)" 1 'rst-reference)
("\\(?:^\\|[ ]\\|['\"([{<‘“«’/:-]\\)\\(|\\(?:\\S \\|\\S \\(?:[^|\\]\\|\\\\.\\)\\{0,1000\\}[^ |\\]\\)|\\)\\(?:$\\|[ ]\\|[]'\")}>’”»/:.,;!?\\-]\\)" 1 'rst-reference)
("\\(?:^\\|[ ]\\|['\"([{<‘“«’/:-]\\)\\(\\(?:acap\\|cid\\|data\\|dav\\|fax\\|file\\|ftp\\|gopher\\|http\\|https\\|imap\\|ldap\\|mailto\\|mid\\|modem\\|news\\|nfs\\|nntp\\|pop\\|prospero\\|rtsp\\|service\\|sip\\|tel\\|telnet\\|tip\\|urn\\|vemmi\\|wais\\):\\S +\\)\\(?:$\\|[ ]\\|[]'\")}>’”»/:.,;!?\\-]\\)" 1 'rst-definition)
("\\(?:^\\|[ ]\\|['\"([{<‘“«’/:-]\\)\\(\\(?:\\sw+\\(?:[+.:_-]\\sw+\\)*\\)@\\(?:\\sw+\\(?:[+.:_-]\\sw+\\)*\\)\\)\\(?:$\\|[ ]\\|[]'\")}>’”»/:.,;!?\\-]\\)" 1 'rst-definition)
("^\\(\\([]!\"#$%&'()*+,./:;<=>?@[\\^_`{|}~-]\\)\\2\\{2,\\}\\)[ ]*$"
(rst-font-lock-handle-adornment-matcher
(rst-font-lock-handle-adornment-pre-match-form
(match-string-no-properties 1)
(match-end 1))
nil
(1
(cdr
(assoc nil rst-adornment-faces-alist))
append t)
(2
(cdr
(assoc rst-font-lock-adornment-level rst-adornment-faces-alist))
append t)
(3
(cdr
(assoc nil rst-adornment-faces-alist))
append t)))
("^[ ]*\\(\\.\\.[ ]+\\)[^[|_\n]\\(?:[^:\n]\\|:\\(?:[^:\n]\\|$\\)\\)*$"
(1 'rst-comment)
(rst-font-lock-find-unindented-line-match
(rst-font-lock-find-unindented-line-limit
(match-end 1))
nil
(0 'rst-comment append)))
("^[ ]*\\(\\.\\.\\)\\([ ]*\\)$"
(1 'rst-comment)
(2 'rst-comment)
(rst-font-lock-find-unindented-line-match
(rst-font-lock-find-unindented-line-limit 'next)
nil
(0 'rst-comment append)))
("^[ ]*\\(\\(?:[^.\n]\\|\\.[^.\n]\\).*\\)?\\(::\\)$"
(2 'rst-block)
(rst-font-lock-find-unindented-line-match
(rst-font-lock-find-unindented-line-limit t)
nil
(0 'rst-literal append)))
("^[ ]*\\(\\(?:>>>\\|\\.\\.\\.\\)\\)\\(.+\\)"
(1 'rst-block)
(2 'rst-literal)))
Documentation
Keywords to highlight in rst mode.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar rst-font-lock-keywords
;; The reST-links in the comments below all relate to sections in
;; https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html.
`(;; FIXME: Block markup is not recognized in blocks after explicit markup
;; start.
;; Simple `Body Elements`_
;; `Bullet Lists`_
;; FIXME: A bullet directly after a field name is not recognized.
(,(rst-re 'lin-beg '(:grp bul-sta))
1 'rst-block)
;; `Enumerated Lists`_
(,(rst-re 'lin-beg '(:grp enmany-sta))
1 'rst-block)
;; `Definition Lists`_
;; FIXME: missing.
;; `Field Lists`_
(,(rst-re 'lin-beg '(:grp fld-tag) 'bli-sfx)
1 'rst-external)
;; `Option Lists`_
(,(rst-re 'lin-beg '(:grp opt-tag (:shy optsep-tag opt-tag) "*")
'(:alt "$" (:seq hws-prt "\\{2\\}")))
1 'rst-block)
;; `Line Blocks`_
;; Only for lines containing no more bar - to distinguish from tables.
(,(rst-re 'lin-beg '(:grp "|" bli-sfx) "[^|\n]*$")
1 'rst-block)
;; `Tables`_
;; FIXME: missing
;; All the `Explicit Markup Blocks`_
;; `Footnotes`_ / `Citations`_
(,(rst-re 'lin-beg 'fnc-sta-2)
(1 'rst-definition)
(2 'rst-definition))
;; `Directives`_ / `Substitution Definitions`_
(,(rst-re 'lin-beg 'dir-sta-3)
(1 'rst-directive)
(2 'rst-definition)
(3 'rst-directive))
;; `Hyperlink Targets`_
(,(rst-re 'lin-beg
'(:grp exm-sta "_" (:alt
(:seq "`" ilcbkqdef-tag "`")
(:seq (:alt "[^:\\\n]" "\\\\.") "+")) ":")
'bli-sfx)
1 'rst-definition)
(,(rst-re 'lin-beg '(:grp "__") 'bli-sfx)
1 'rst-definition)
;; All `Inline Markup`_
;; Most of them may be multiline though this is uninteresting.
;; FIXME: Condition 5 preventing fontification of e.g. "*" not implemented
;; `Strong Emphasis`_.
(,(rst-re 'ilm-pfx '(:grp "\\*\\*" ilcast-tag "\\*\\*") 'ilm-sfx)
1 'rst-emphasis2)
;; `Emphasis`_
(,(rst-re 'ilm-pfx '(:grp "\\*" ilcast-tag "\\*") 'ilm-sfx)
1 'rst-emphasis1)
;; `Inline Literals`_
(,(rst-re 'ilm-pfx '(:grp "``" ilcbkq-tag "``") 'ilm-sfx)
1 'rst-literal)
;; `Inline Internal Targets`_
(,(rst-re 'ilm-pfx '(:grp "_`" ilcbkq-tag "`") 'ilm-sfx)
1 'rst-definition)
;; `Hyperlink References`_
;; FIXME: `Embedded URIs and Aliases`_ not considered.
;; FIXME: Directly adjacent marked up words are not fontified correctly
;; unless they are not separated by two spaces: foo_ bar_.
(,(rst-re 'ilm-pfx '(:grp (:alt (:seq "`" ilcbkq-tag "`")
(:seq "\\sw" (:alt "\\sw" "-") "+\\sw"))
"__?") 'ilm-sfx)
1 'rst-reference)
;; `Interpreted Text`_
(,(rst-re 'ilm-pfx '(:grp (:shy ":" sym-tag ":") "?")
'(:grp "`" ilcbkq-tag "`")
'(:grp (:shy ":" sym-tag ":") "?") 'ilm-sfx)
(1 'rst-directive)
(2 'rst-external)
(3 'rst-directive))
;; `Footnote References`_ / `Citation References`_
(,(rst-re 'ilm-pfx '(:grp fnc-tag "_") 'ilm-sfx)
1 'rst-reference)
;; `Substitution References`_
;; FIXME: References substitutions like |this|_ or |this|__ are not
;; fontified correctly.
(,(rst-re 'ilm-pfx '(:grp sub-tag) 'ilm-sfx)
1 'rst-reference)
;; `Standalone Hyperlinks`_
;; FIXME: This takes it easy by using a whitespace as delimiter.
(,(rst-re 'ilm-pfx '(:grp uri-tag ":\\S +") 'ilm-sfx)
1 'rst-definition)
(,(rst-re 'ilm-pfx '(:grp sym-tag "@" sym-tag ) 'ilm-sfx)
1 'rst-definition)
;; Do all block fontification as late as possible so 'append works.
;; Sections_ / Transitions_
;; For sections this is multiline.
(,(rst-re 'ado-beg-2-1)
(rst-font-lock-handle-adornment-matcher
(rst-font-lock-handle-adornment-pre-match-form
(match-string-no-properties 1) (match-end 1))
nil
(1 (cdr (assoc nil rst-adornment-faces-alist)) append t)
(2 (cdr (assoc rst-font-lock-adornment-level
rst-adornment-faces-alist)) append t)
(3 (cdr (assoc nil rst-adornment-faces-alist)) append t)))
;; FIXME: FACESPEC could be used instead of ordinary faces to set
;; properties on comments and literal blocks so they are *not*
;; inline fontified. See (elisp)Search-based Fontification.
;; FIXME: And / or use `syntax-propertize' functions as in `octave-mod.el'
;; and other V24 modes. May make `font-lock-extend-region'
;; superfluous.
;; `Comments`_
;; This is multiline.
(,(rst-re 'lin-beg 'cmt-sta-1)
(1 'rst-comment)
(rst-font-lock-find-unindented-line-match
(rst-font-lock-find-unindented-line-limit (match-end 1))
nil
(0 'rst-comment append)))
(,(rst-re 'lin-beg '(:grp exm-tag) '(:grp hws-tag) "$")
(1'rst-comment)
(2'rst-comment)
(rst-font-lock-find-unindented-line-match
(rst-font-lock-find-unindented-line-limit 'next)
nil
(0 'rst-comment append)))
;; FIXME: This is not rendered as comment::
;; .. .. list-table::
;; :stub-columns: 1
;; :header-rows: 1
;; FIXME: This is rendered wrong::
;;
;; xxx yyy::
;;
;; ----|> KKKKK <|----
;; / \
;; -|> AAAAAAAAAAPPPPPP <|- -|> AAAAAAAAAABBBBBBB <|-
;; | | | |
;; | | | |
;; PPPPPP PPPPPPDDDDDDD BBBBBBB PPPPPPBBBBBBB
;;
;; Indentation needs to be taken from the line with the ``::`` and not from
;; the first content line.
;; `Indented Literal Blocks`_
;; This is multiline.
(,(rst-re 'lin-beg 'lit-sta-2)
(2 'rst-block)
(rst-font-lock-find-unindented-line-match
(rst-font-lock-find-unindented-line-limit t)
nil
(0 'rst-literal append)))
;; FIXME: `Quoted Literal Blocks`_ missing.
;; This is multiline.
;; `Doctest Blocks`_
;; FIXME: This is wrong according to the specification:
;;
;; Doctest blocks are text blocks which begin with ">>> ", the Python
;; interactive interpreter main prompt, and end with a blank line.
;; Doctest blocks are treated as a special case of literal blocks,
;; without requiring the literal block syntax. If both are present, the
;; literal block syntax takes priority over Doctest block syntax:
;;
;; This is an ordinary paragraph.
;;
;; >>> print 'this is a Doctest block'
;; this is a Doctest block
;;
;; The following is a literal block::
;;
;; >>> This is not recognized as a doctest block by
;; reStructuredText. It *will* be recognized by the doctest
;; module, though!
;;
;; Indentation is not required for doctest blocks.
(,(rst-re 'lin-beg '(:grp (:alt ">>>" ell-tag)) '(:grp ".+"))
(1 'rst-block)
(2 'rst-literal)))
"Keywords to highlight in rst mode.")