Skip to content
Back to top
View this page

# constants

This module contains constants used throughout the `chango` package.

class chango.constants.MarkupLanguage(*values)

  Commonly known markup languages

  ASCIIDOC = 'asciidoc'

    The AsciiDoc markup language

  CREOLE = 'creole'

    The Creole markup language

  HTML = 'html'

    The HyperText Markup Language

  MARKDOWN = 'markdown'

    The Markdown markup language

  MEDIAWIKI = 'mediawiki'

    The MediaWiki markup language

  ORG = 'org'

    The Org-mode markup language

  POD = 'pod'

    The Plain Old Documentation markup language

  RDOC = 'rdoc'

    The RDoc markup language

  RESTRUCTUREDTEXT = 'rst'

    The reStructuredText markup language

  TEXT = 'txt'

    Plain text

  TEXTILE = 'textile'

    The Textile markup language

  classmethod from_string(string, mapping=None)

    Get the markup language enum member from a string by comparing against the members of this enum as well as commonly used file extensions. Case-insensitive. Leading dots are ignored.

    Parameters:

      - string (`str`) – The string to look up.

      - mapping (`Mapping` [`str`, `MarkupLanguage`] | `None`) – A mapping of file extensions to markup languages. If not provided, the default mapping will be used.

    Returns:

      The markup language enum member.

    Return type:

      `MarkupLanguage`

    Raises:

      ValueError – If the file extension can not be resolved to a markup language.