Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

code friendly

agriffis edited this page · 3 revisions

code-friendly extra

The code-friendly extra disables the use of leading and trailing and (most importantly) intra-word emphasis and strong using underscores. These can easily get in the way when writing docs about source code with variables_like_this or (common in Python) like the following: _my_internal_var, __version__, __init__, __repr__, etc.

command-line usage

$ 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>

module usage

>>> 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"

Discussion

It is quite common for other Markdown implementations to disable intra-word emphasis either by default or with an extra. Examples are Stack Overflow, Github Flavored Markdown and 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.)

Something went wrong with that request. Please try again.