-
Notifications
You must be signed in to change notification settings - Fork 434
code friendly
The code-friendly
extra disables the use of leading, trailing and --most importantly-- intra-word emphasis (<em>
) and strong (<strong>
) using single or double underscores, respectively.
These can easily get in the way when writing documents about source code that uses snake_case for programming language keywords, such as variables_like_this
or (common in Python) like the following: _my_internal_var
, __version__
, __init__
, __repr__
, etc.
$ cat foo.txt
use 'self.this_long_attr' for the *real* mccoy
$ markdown2 -x code-friendly foo.txt
<p>use 'self.this_long_attr' for the <em>real</em> mccoy</p>
>>> markdown2.markdown("use 'self.this_long_attr' for the *real* mccoy")
"<p>use 'self.this<em>long</em>attr' for the <em>real</em> mccoy</p>\n"
>>> markdown2.markdown("use 'self.this_long_attr' for the *real* mccoy",
... extras=["code-friendly"])
"<p>use 'self.this_long_attr' for the <em>real</em> mccoy</p>\n"
It is quite common for other Markdown implementations to disable intra-word emphasis either by default or with an extra. Examples are StackOverflow, Github Flavored Markdown and the PHP Markdown Extra -- though their details differ slightly (see issue 38 for some quick details). At the time of this writing python-markdown2 doesn't have a facility that disables just intra-word emphasis like some of the above. I may add one as part of issue 38.
(Return to Extras page.)