File: rst.el.html
This package provides major mode rst-mode, which supports documents marked up using the reStructuredText format. Support includes font locking as well as a lot of convenience functions for editing. It does this by defining a Emacs major mode: rst-mode (ReST). This mode is derived from text-mode. This package also contains:
- Functions to automatically adjust and cycle the section underline
adornments;
- A mode that displays the table of contents and allows you to jump anywhere
from it;
- Functions to insert and automatically update a TOC in your source
document;
- Function to insert list, processing item bullets and enumerations
automatically;
- Font-lock highlighting of most reStructuredText structures;
- Indentation and filling according to reStructuredText syntax;
- Cursor movement according to reStructuredText syntax;
- Some other convenience functions.
See the accompanying document in the docutils documentation about the contents of this package and how to use it.
For more information about reStructuredText, see https://docutils.sourceforge.io/rst.html
For full details on how to use the contents of this file, see https://docutils.sourceforge.io/docs/user/emacs.html
There are a number of convenient key bindings provided by rst-mode. For the bindings, try C-c C-h when in rst-mode. There are also many variables that can be customized, look for defcustom in this file or look for the "rst" customization group contained in the "text" group.
If you use the table-of-contents feature, you may want to add a hook to update the TOC automatically every time you adjust a section title::
(add-hook 'rst-adjust-hook 'rst-toc-update)
Syntax highlighting: font-lock is enabled by default. If you want to turn off syntax highlighting to rst-mode, you can use the following::
(setq font-lock-global-modes '(not rst-mode ...))
; DOWNLOAD
The latest release of this file lies in the docutils source code repository:
https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/tools/editors/emacs/rst.el
; INSTALLATION
Add the following lines to your init file:
(require 'rst)
If you are using .txt as a standard extension for reST files as
https://docutils.sourceforge.io/FAQ.html#what-s-the-standard-filename-extension-for-a-restructuredtext-file
suggests you may use one of the Local Variables in Files mechanism Emacs
provides to set the major mode automatically. For instance you may use::
.. -*- mode: rst -*-
in the very first line of your file. The following code is useful if you want automatically enter rst-mode from any file with compatible extensions:
(setq auto-mode-alist (append '(("\\\\.txt\\\\'" . rst-mode) ("\\\\.rst\\\\'" . rst-mode) ("\\\\.rest\\\\'" . rst-mode)) auto-mode-alist))
Defined variables (57)
rst-adjust-hook | Hooks to be run after running ‘rst-adjust’. |
rst-adornment-chars | Characters which may be used in adornments for sections and transitions. |
rst-adornment-faces-alist | Faces for the various adornment types. |
rst-all-ttls-cache | All section adornments in the buffer as found by ‘rst-all-ttls’. |
rst-arabic-to-roman | List of maps between Arabic numbers and their Roman numeral equivalents. |
rst-bullets | List of all possible bullet characters for bulleted lists. |
rst-compile-primary-toolset | The default tool-set for ‘rst-compile’. |
rst-compile-secondary-toolset | The default tool-set for ‘rst-compile’ with a prefix argument. |
rst-compile-toolsets | Table describing the command to use for each tool-set. |
rst-cvs-rev | The CVS revision of this file. CVS revision is the development revision. |
rst-cvs-timestamp | The CVS time stamp of this file. |
rst-default-indent | Number of characters to indent the section title. |
rst-font-lock-adornment-level | Storage for ‘rst-font-lock-handle-adornment-matcher’. |
rst-font-lock-adornment-match | Storage for match for current adornment. |
rst-font-lock-find-unindented-line-begin | Beginning of the match if ‘rst-font-lock-find-unindented-line-end’. |
rst-font-lock-find-unindented-line-end | End of the match as determined by ‘rst-font-lock-find-unindented-line-limit’. |
rst-font-lock-keywords | Keywords to highlight in rst mode. |
rst-hdr-hierarchy-cache | Section hierarchy in the buffer as determined by ‘rst-hdr-hierarchy’. |
rst-indent-comment | Default indentation for first line of a comment. |
rst-indent-field | Indentation for first line after a field or 0 to always indent for content. |
rst-indent-literal-minimized | Default indentation for literal block after a minimized markup. |
rst-indent-literal-normal | Default indentation for literal block after a markup on an own line. |
rst-indent-width | Indentation when there is no more indentation point given. |
rst-initial-items | List of initial items. It’s a collection of bullets and enumerations. |
rst-max-inline-length | Maximum length of inline markup to recognize. |
rst-minor-mode | Non-nil if Rst minor mode is enabled. |
rst-minor-mode-hook | Hook run after entering or leaving ‘rst-minor-mode’. |
rst-mode-abbrev-table | Abbrev table used while in ‘rst-mode’. |
rst-mode-hook | Hook run when ‘rst-mode’ is turned on. |
rst-mode-map | Keymap for reStructuredText mode commands. |
rst-mode-syntax-table | Syntax table used while in ‘rst-mode’. |
rst-new-adornment-down | Controls level of new adornment for section headers. |
rst-official-cvs-rev | CVS revision of this file in the official version. |
rst-official-version | Official version of the package. |
rst-pdf-program | Program used to preview PDF files. |
rst-preferred-adornments | Preferred hierarchy of section title adornments. |
rst-preferred-bullets | List of favorite bullets. |
rst-preferred-decorations | Preferred hierarchy of section title adornments. |
rst-re-alist | Alist mapping symbols from ‘rst-re-alist-def’ to regex strings. |
rst-re-alist-def | Definition alist of relevant regexes. |
rst-shift-basic-offset | Indentation when there is no more indentation point given. |
rst-slides-program | Program used to preview S5 slides. |
rst-svn-rev | The SVN revision of this file. |
rst-svn-timestamp | The SVN time stamp of this file. |
rst-toc-buffer-name | Name of the Table of Contents buffer. |
rst-toc-indent | Indentation for table-of-contents display. |
rst-toc-insert-max-level | If non-nil, maximum depth of the inserted TOC. |
rst-toc-insert-number-separator | Separator that goes between the TOC number and the title. |
rst-toc-insert-style | Insertion style for table-of-contents. |
rst-toc-link-keymap | Keymap used for links in TOC. |
rst-toc-mode-abbrev-table | Abbrev table for ‘rst-toc-mode’. |
rst-toc-mode-hook | Hook run after entering ‘rst-toc-mode’. |
rst-toc-mode-map | Keymap for ‘rst-toc-mode’. |
rst-toc-mode-return-wincfg | Window configuration to which to return when leaving the TOC. |
rst-toc-mode-syntax-table | Syntax table for ‘rst-toc-mode’. |
rst-uri-schemes | Supported URI schemes. |
rst-version | The version string. |
Defined functions (201)
Defined faces (17)
rst-adornment | Face used for the adornment of a section header. |
rst-block | Face used for all syntax marking up a special block. |
rst-comment | Face used for comments. |
rst-definition | Face used for all other defining constructs. |
rst-directive | Face used for directives and roles. |
rst-emphasis1 | Face used for simple emphasis. |
rst-emphasis2 | Face used for double emphasis. |
rst-external | Face used for field names and interpreted text. |
rst-level-1 | Default face for section title text at level 1. |
rst-level-2 | Default face for section title text at level 2. |
rst-level-3 | Default face for section title text at level 3. |
rst-level-4 | Default face for section title text at level 4. |
rst-level-5 | Default face for section title text at level 5. |
rst-level-6 | Default face for section title text at level 6. |
rst-literal | Face used for literal text. |
rst-reference | Face used for references to a definition. |
rst-transition | Face used for a transition. |