Skip to content

Commit 18452b5

Browse files
committed
Simplify output_formats to html and xhtml.
We started with the numbers before HTML5 was a thing and we thought there might be an XHTML2. Today, we know that all we have are HTML style tags and XHTML style tags. Nothing else really matters in the real world. Note that if '(x)html1' '(x)html4' or '(x)html5' are passed in, the number is stripped/ignored. Users shouldn't need to change their code for this.
1 parent 6edbd5a commit 18452b5

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

markdown/core.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class Markdown(object):
2525
doc_tag = "div" # Element used to wrap document - later removed
2626

2727
option_defaults = {
28-
'html_replacement_text': '[HTML_REMOVED]',
2928
'tab_length': 4,
3029
'enable_attributes': True,
3130
'smart_emphasis': True,
@@ -34,11 +33,7 @@ class Markdown(object):
3433

3534
output_formats = {
3635
'html': to_html_string,
37-
'html4': to_html_string,
38-
'html5': to_html_string,
3936
'xhtml': to_xhtml_string,
40-
'xhtml1': to_xhtml_string,
41-
'xhtml5': to_xhtml_string,
4237
}
4338

4439
ESCAPED_CHARS = ['\\', '`', '*', '_', '{', '}', '[', ']',
@@ -56,17 +51,8 @@ def __init__(self, **kwargs):
5651
they will be used as-is.
5752
* extension_configs: Configuration settings for extensions.
5853
* output_format: Format of output. Supported formats are:
59-
* "xhtml1": Outputs XHTML 1.x. Default.
60-
* "xhtml5": Outputs XHTML style tags of HTML 5
61-
* "xhtml": Outputs latest supported version of XHTML
62-
(currently XHTML 1.1).
63-
* "html4": Outputs HTML 4
64-
* "html5": Outputs HTML style tags of HTML 5
65-
* "html": Outputs latest supported version of HTML
66-
(currently HTML 4).
67-
Note that it is suggested that the more specific formats ("xhtml1"
68-
and "html4") be used as "xhtml" or "html" may change in the future
69-
if it makes sense at that time.
54+
* "xhtml": Outputs XHTML style tags. Default.
55+
* "html": Outputs HTML style tags.
7056
* tab_length: Length of tabs in the source. Default: 4
7157
* enable_attributes: Enable the conversion of attributes. Default: True
7258
* smart_emphasis: Treat `_connected_words_` intelligently Default: True
@@ -88,7 +74,7 @@ def __init__(self, **kwargs):
8874
self.htmlStash = util.HtmlStash()
8975
self.registerExtensions(extensions=kwargs.get('extensions', []),
9076
configs=kwargs.get('extension_configs', {}))
91-
self.set_output_format(kwargs.get('output_format', 'xhtml1'))
77+
self.set_output_format(kwargs.get('output_format', 'xhtml'))
9278
self.reset()
9379

9480
def build_parser(self):
@@ -166,7 +152,7 @@ def reset(self):
166152

167153
def set_output_format(self, format):
168154
""" Set the output format for the class instance. """
169-
self.output_format = format.lower()
155+
self.output_format = format.lower().rstrip('145')
170156
try:
171157
self.serializer = self.output_formats[self.output_format]
172158
except KeyError as e:

0 commit comments

Comments
 (0)