diff --git a/README.rst b/README.rst
index a19fabe..1e245c1 100644
--- a/README.rst
+++ b/README.rst
@@ -76,10 +76,16 @@ bullets
level. Defaults to ``'*+-'``.
strong_em_symbol
- In markdown, both ``*`` and ``_`` are used to encode **strong** or *emphasized* texts. The preferred symbol can be passed through this argument, that defaults to ``*``.
+ In markdown, both ``*`` and ``_`` are used to encode **strong** or
+ *emphasized* texts. Either of these symbols can be chosen by the options
+ ``ASTERISK`` (default) or ``UNDERSCORE`` respectively.
newline_style
- Defines the style of marking linebreaks (``
``) in markdown. The default value ``SPACES`` of this option will adopt the usual two spaces and a newline, while ``BACKSLASH`` will convert a linebreak to ``\\n`` (a backslash an a newline). While the latter convention is non-standard, it is commonly preferred and supported by a lot of interpreters.
+ Defines the style of marking linebreaks (``
``) in markdown. The default
+ value ``SPACES`` of this option will adopt the usual two spaces and a newline,
+ while ``BACKSLASH`` will convert a linebreak to ``\\n`` (a backslash an a
+ newline). While the latter convention is non-standard, it is commonly
+ preferred and supported by a lot of interpreters.
Options may be specified as kwargs to the ``markdownify`` function, or as a
nested ``Options`` class in ``MarkdownConverter`` subclasses.
diff --git a/markdownify/__init__.py b/markdownify/__init__.py
index 08819aa..6f90d73 100644
--- a/markdownify/__init__.py
+++ b/markdownify/__init__.py
@@ -19,6 +19,10 @@ SETEXT = UNDERLINED
SPACES = 'spaces'
BACKSLASH = 'backslash'
+# Strong and emphasis style
+ASTERISK = '*'
+UNDERSCORE = '_'
+
def escape(text):
if not text:
@@ -50,7 +54,7 @@ class MarkdownConverter(object):
autolinks = True
heading_style = UNDERLINED
bullets = '*+-' # An iterable of bullet types.
- strong_em_symbol = '*'
+ strong_em_symbol = ASTERISK
newline_style = SPACES
class Options(DefaultOptions):
diff --git a/tests/test_conversions.py b/tests/test_conversions.py
index d07d487..e974c78 100644
--- a/tests/test_conversions.py
+++ b/tests/test_conversions.py
@@ -1,4 +1,4 @@
-from markdownify import markdownify as md, ATX, ATX_CLOSED, BACKSLASH
+from markdownify import markdownify as md, ATX, ATX_CLOSED, BACKSLASH, UNDERSCORE
import re
@@ -219,10 +219,10 @@ def test_div():
def test_strong_em_symbol():
- assert md('Hello', strong_em_symbol='_') == '__Hello__'
- assert md('Hello', strong_em_symbol='_') == '__Hello__'
- assert md('Hello', strong_em_symbol='_') == '_Hello_'
- assert md('Hello', strong_em_symbol='_') == '_Hello_'
+ assert md('Hello', strong_em_symbol=UNDERSCORE) == '__Hello__'
+ assert md('Hello', strong_em_symbol=UNDERSCORE) == '__Hello__'
+ assert md('Hello', strong_em_symbol=UNDERSCORE) == '_Hello_'
+ assert md('Hello', strong_em_symbol=UNDERSCORE) == '_Hello_'
def test_newline_style():