.. _DIR/UnicodeTable: unicode-table ############# .. grid:: 2 .. grid-item:: :columns: 6 The ``unicode-table`` directive lists icons - Unicode characters, e.g. emoji - with their Unicode names and code points, e.g. the icons a :ref:`tree ` uses. The **content** is the icons, one per line, written as characters or as code points. An icon may have a **description**, behind a ``|``. The **names** and **code points** are computed from the icon, so a row can't contradict its icon. In HTML, a **button** beside the icon copies the icon into the clipboard, and a button beside the code points copies these - in the form a tree's icon options take them. .. grid-item:: :columns: 6 .. code-block:: ReST .. unicode-table:: 📦 | a package U+1F4C1 | a directory U+2699 U+FE0F | a configuration file 👨‍💻 This is how the example renders: .. unicode-table:: 📦 | a package U+1F4C1 | a directory U+2699 U+FE0F | a configuration file 👨‍💻 :ref:`DIR/Tree/CommonIcons` lists icons commonly used in a tree, by this directive. .. _DIR/UnicodeTable/Content: Content ******* * An entry is a line holding an icon. Blank lines are ignored. * An icon is written as characters, e.g. ``📁``, or as Unicode code points, e.g. ``U+1F4C1``. Several words form one icon, and characters and code points may be mixed: ``U+2699 U+FE0F`` and ``⚙ U+FE0F`` are the same icon. A code point keeps the source readable in an editor whose font lacks the icon's glyph, and shows a variation selector, which is invisible as a character. * A ``|`` between spaces separates the icon from its **description**, which is inline ReST. A table without any description has no column for them. * Spaces around the ``|`` don't matter, so the separators may be aligned in the source. A ``|`` in an inline literal or in a role's text separates nothing; elsewhere, a ``|`` belonging to the description is escaped as ``\|``. .. _DIR/UnicodeTable/Names: Names and code points ********************* The names are the ones Python's :mod:`unicodedata` knows, so a name is always the icon's. * A single character is named by its Unicode name: ``📦`` is ``PACKAGE``. * A **sequence** is named by its characters, joined by ``+``: ``👨‍💻`` is ``MAN + PERSONAL COMPUTER``. A variation selector and the zero width joiner select how the characters are drawn and aren't named: ``⚙️`` - ``U+2699 U+FE0F`` - is ``GEAR``. * A character without a name - a control character, a private-use character or a noncharacter - is named by the label the Unicode standard gives it, e.g. ````. An icon font such as a Nerd Font maps its icons to private-use characters. * A code point not assigned in the Unicode version of :mod:`unicodedata` is named ```` and warned about: either it is a typo, or the icon is newer than the Python running the build. Python 3.12 knows Unicode 15.0, 3.13 Unicode 15.1 and 3.14 Unicode 16.0. The code points are written as the icon options of the :ref:`tree ` take them: ``U+`` and at least four hexadecimal digits per character, separated by spaces. .. _DIR/UnicodeTable/Options: Options ******* .. rst:directive:: .. unicode-table:: Lists the icons written in the content, with their names and code points. .. rst:directive:option:: class: Additional CSS classes on the table. .. _DIR/UnicodeTable/Copy: Copy buttons ************ In HTML, the icon and the code points are each followed by a ``