summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2015-03-28 21:48:41 -0400
committerWaylan Limberg <waylan.limberg@icloud.com>2015-04-22 19:53:48 -0400
commit18452b5912dc9826bb43ea7f36987c5837052607 (patch)
tree7c92469638443274ffe9c79246dac264019fbd1e
parent6edbd5aae4123baf8554386883ddf1cd9f698a57 (diff)
downloadpython-markdown-18452b5912dc9826bb43ea7f36987c5837052607.tar.gz
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.
-rw-r--r--markdown/core.py22
1 files changed, 4 insertions, 18 deletions
diff --git a/markdown/core.py b/markdown/core.py
index 773e984..c2c90b6 100644
--- a/markdown/core.py
+++ b/markdown/core.py
@@ -25,7 +25,6 @@ class Markdown(object):
doc_tag = "div" # Element used to wrap document - later removed
option_defaults = {
- 'html_replacement_text': '[HTML_REMOVED]',
'tab_length': 4,
'enable_attributes': True,
'smart_emphasis': True,
@@ -34,11 +33,7 @@ class Markdown(object):
output_formats = {
'html': to_html_string,
- 'html4': to_html_string,
- 'html5': to_html_string,
'xhtml': to_xhtml_string,
- 'xhtml1': to_xhtml_string,
- 'xhtml5': to_xhtml_string,
}
ESCAPED_CHARS = ['\\', '`', '*', '_', '{', '}', '[', ']',
@@ -56,17 +51,8 @@ class Markdown(object):
they will be used as-is.
* extension_configs: Configuration settings for extensions.
* output_format: Format of output. Supported formats are:
- * "xhtml1": Outputs XHTML 1.x. Default.
- * "xhtml5": Outputs XHTML style tags of HTML 5
- * "xhtml": Outputs latest supported version of XHTML
- (currently XHTML 1.1).
- * "html4": Outputs HTML 4
- * "html5": Outputs HTML style tags of HTML 5
- * "html": Outputs latest supported version of HTML
- (currently HTML 4).
- Note that it is suggested that the more specific formats ("xhtml1"
- and "html4") be used as "xhtml" or "html" may change in the future
- if it makes sense at that time.
+ * "xhtml": Outputs XHTML style tags. Default.
+ * "html": Outputs HTML style tags.
* tab_length: Length of tabs in the source. Default: 4
* enable_attributes: Enable the conversion of attributes. Default: True
* smart_emphasis: Treat `_connected_words_` intelligently Default: True
@@ -88,7 +74,7 @@ class Markdown(object):
self.htmlStash = util.HtmlStash()
self.registerExtensions(extensions=kwargs.get('extensions', []),
configs=kwargs.get('extension_configs', {}))
- self.set_output_format(kwargs.get('output_format', 'xhtml1'))
+ self.set_output_format(kwargs.get('output_format', 'xhtml'))
self.reset()
def build_parser(self):
@@ -166,7 +152,7 @@ class Markdown(object):
def set_output_format(self, format):
""" Set the output format for the class instance. """
- self.output_format = format.lower()
+ self.output_format = format.lower().rstrip('145')
try:
self.serializer = self.output_formats[self.output_format]
except KeyError as e: