zero.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. """
  2. "Zero" preset, with nothing enabled. Useful for manual configuring of simple
  3. modes. For example, to parse bold/italic only.
  4. """
  5. from ..utils import PresetType
  6. def make() -> PresetType:
  7. return {
  8. "options": {
  9. "maxNesting": 20, # Internal protection, recursion limit
  10. "html": False, # Enable HTML tags in source
  11. # this is just a shorthand for .disable(["html_inline", "html_block"])
  12. # used by the linkify rule:
  13. "linkify": False, # autoconvert URL-like texts to links
  14. # used by the replacements and smartquotes rules:
  15. # Enable some language-neutral replacements + quotes beautification
  16. "typographer": False,
  17. # used by the smartquotes rule:
  18. # Double + single quotes replacement pairs, when typographer enabled,
  19. # and smartquotes on. Could be either a String or an Array.
  20. # For example, you can use '«»„“' for Russian, '„“‚‘' for German,
  21. # and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
  22. "quotes": "\u201c\u201d\u2018\u2019", # /* “”‘’ */
  23. # Renderer specific; these options are used directly in the HTML renderer
  24. "xhtmlOut": False, # Use '/' to close single tags (<br />)
  25. "breaks": False, # Convert '\n' in paragraphs into <br>
  26. "langPrefix": "language-", # CSS language prefix for fenced blocks
  27. # Highlighter function. Should return escaped HTML,
  28. # or '' if the source string is not changed and should be escaped externally.
  29. # If result starts with <pre... internal wrapper is skipped.
  30. # function (/*str, lang, attrs*/) { return ''; }
  31. "highlight": None,
  32. },
  33. "components": {
  34. "core": {"rules": ["normalize", "block", "inline", "text_join"]},
  35. "block": {"rules": ["paragraph"]},
  36. "inline": {
  37. "rules": ["text"],
  38. "rules2": ["balance_pairs", "fragments_join"],
  39. },
  40. },
  41. }