1import re
2
3# Use Unicode characters instead of their ascii pseudo-replacements
4UNICODE_SNOB = False
5
6# Marker to use for marking tables for padding post processing
7TABLE_MARKER_FOR_PAD = "special_marker_for_table_padding"
8# Escape all special characters.  Output is less readable, but avoids
9# corner case formatting issues.
10ESCAPE_SNOB = False
11
12# Put the links after each paragraph instead of at the end.
13LINKS_EACH_PARAGRAPH = False
14
15# Wrap long lines at position. 0 for no wrapping.
16BODY_WIDTH = 78
17
18# Don't show internal links (href="#local-anchor") -- corresponding link
19# targets won't be visible in the plain text file anyway.
20SKIP_INTERNAL_LINKS = True
21
22# Use inline, rather than reference, formatting for images and links
23INLINE_LINKS = True
24
25# Protect links from line breaks surrounding them with angle brackets (in
26# addition to their square brackets)
27PROTECT_LINKS = False
28# WRAP_LINKS = True
29WRAP_LINKS = True
30
31# Wrap list items.
32WRAP_LIST_ITEMS = False
33
34# Number of pixels Google indents nested lists
35GOOGLE_LIST_INDENT = 36
36
37# Values Google and others may use to indicate bold text
38BOLD_TEXT_STYLE_VALUES = ("bold", "700", "800", "900")
39
40IGNORE_ANCHORS = False
41IGNORE_IMAGES = False
42IMAGES_AS_HTML = False
43IMAGES_TO_ALT = False
44IMAGES_WITH_SIZE = False
45IGNORE_EMPHASIS = False
46MARK_CODE = False
47DECODE_ERRORS = "strict"
48DEFAULT_IMAGE_ALT = ""
49PAD_TABLES = False
50
51# Convert links with same href and text to <href> format
52# if they are absolute links
53USE_AUTOMATIC_LINKS = True
54
55# For checking space-only lines on line 771
56RE_SPACE = re.compile(r"\s\+")
57
58RE_ORDERED_LIST_MATCHER = re.compile(r"\d+\.\s")
59RE_UNORDERED_LIST_MATCHER = re.compile(r"[-\*\+]\s")
60RE_MD_CHARS_MATCHER = re.compile(r"([\\\[\]\(\)])")
61RE_MD_CHARS_MATCHER_ALL = re.compile(r"([`\*_{}\[\]\(\)#!])")
62
63# to find links in the text
64RE_LINK = re.compile(r"(\[.*?\] ?\(.*?\))|(\[.*?\]:.*?)")
65
66RE_MD_DOT_MATCHER = re.compile(
67    r"""
68    ^             # start of line
69    (\s*\d+)      # optional whitespace and a number
70    (\.)          # dot
71    (?=\s)        # lookahead assert whitespace
72    """,
73    re.MULTILINE | re.VERBOSE,
74)
75RE_MD_PLUS_MATCHER = re.compile(
76    r"""
77    ^
78    (\s*)
79    (\+)
80    (?=\s)
81    """,
82    flags=re.MULTILINE | re.VERBOSE,
83)
84RE_MD_DASH_MATCHER = re.compile(
85    r"""
86    ^
87    (\s*)
88    (-)
89    (?=\s|\-)     # followed by whitespace (bullet list, or spaced out hr)
90                  # or another dash (header or hr)
91    """,
92    flags=re.MULTILINE | re.VERBOSE,
93)
94RE_SLASH_CHARS = r"\`*_{}[]()#+-.!"
95RE_MD_BACKSLASH_MATCHER = re.compile(
96    r"""
97    (\\)          # match one slash
98    (?=[%s])      # followed by a char that requires escaping
99    """
100    % re.escape(RE_SLASH_CHARS),
101    flags=re.VERBOSE,
102)
103
104UNIFIABLE = {
105    "rsquo": "'",
106    "lsquo": "'",
107    "rdquo": '"',
108    "ldquo": '"',
109    "copy": "(C)",
110    "mdash": "--",
111    "nbsp": " ",
112    "rarr": "->",
113    "larr": "<-",
114    "middot": "*",
115    "ndash": "-",
116    "oelig": "oe",
117    "aelig": "ae",
118    "agrave": "a",
119    "aacute": "a",
120    "acirc": "a",
121    "atilde": "a",
122    "auml": "a",
123    "aring": "a",
124    "egrave": "e",
125    "eacute": "e",
126    "ecirc": "e",
127    "euml": "e",
128    "igrave": "i",
129    "iacute": "i",
130    "icirc": "i",
131    "iuml": "i",
132    "ograve": "o",
133    "oacute": "o",
134    "ocirc": "o",
135    "otilde": "o",
136    "ouml": "o",
137    "ugrave": "u",
138    "uacute": "u",
139    "ucirc": "u",
140    "uuml": "u",
141    "lrm": "",
142    "rlm": "",
143}
144
145# Format tables in HTML rather than Markdown syntax
146BYPASS_TABLES = False
147# Ignore table-related tags (table, th, td, tr) while keeping rows
148IGNORE_TABLES = False
149
150
151# Use a single line break after a block element rather than two line breaks.
152# NOTE: Requires body width setting to be 0.
153SINGLE_LINE_BREAK = False
154
155
156# Use double quotation marks when converting the <q> tag.
157OPEN_QUOTE = '"'
158CLOSE_QUOTE = '"'
159