diff --git a/README.md b/README.md index 8125943..b8d6950 100644 --- a/README.md +++ b/README.md @@ -253,6 +253,18 @@ var defaultOptions = showdown.getDefaultOptions(); ```html
some text with__underscores__in middle
``` + + * **literalMidWordAsterisks**: (boolean) [default false] Turning this on will stop showdown from interpreting asterisks in the middle of words as `` and `` and instead treat them as literal asterisks. + + Example: + + ```md + some text with**underscores**in middle + ``` + will be parsed as + ```html +some text with**underscores**in middle
+ ``` * **strikethrough**: (boolean) [default false] Enable support for strikethrough syntax. `~~strikethrough~~` as `this is a sentence*with*mid asterisks
+this is a sentence**with**two mid asterisks
+this is a sentence***with***three mid asterisks
+this is a sentence with just*one asterisk
+this is a sentence with just**one asterisk
+this is a sentence with just***one asterisk
+this is double**asterisk**mid word
+this has just**one double asterisk
+this has just***one triple asterisk
+this should be parsed as emphasis
+this should be parsed as bold
+this should be parsed as bold and emphasis
+emphasis at end of sentence
+bold at end of sentence
+bold and emphasis at end of sentence
+emphasis at line start
+bold at line start
+bold and emphasis at line start
+multi line emphasis +yeah it is yeah
+multi line emphasis +yeah it is yeah
+multi line emphasis +yeah it is yeah
diff --git a/test/features/enable-literalMidWordAsterisks.md b/test/features/enable-literalMidWordAsterisks.md new file mode 100644 index 0000000..b4d132d --- /dev/null +++ b/test/features/enable-literalMidWordAsterisks.md @@ -0,0 +1,46 @@ +this is a sentence*with*mid asterisks + +this is a sentence**with**two mid asterisks + +this is a sentence***with***three mid asterisks + +this is a sentence with just*one asterisk + +this is a sentence with just**one asterisk + +this is a sentence with just***one asterisk + +this is double**asterisk**mid word + +this has just**one double asterisk + +this has just***one triple asterisk + +this *should be parsed* as emphasis + +this **should be parsed** as bold + +this ***should be parsed*** as bold and emphasis + +emphasis at *end of sentence* + +bold at **end of sentence** + +bold and emphasis at ***end of sentence*** + +*emphasis at* line start + +**bold at** line start + +***bold and emphasis at*** line start + +multi *line emphasis +yeah it is* yeah + + +multi **line emphasis +yeah it is** yeah + + +multi ***line emphasis +yeah it is*** yeah diff --git a/test/node/testsuite.features.js b/test/node/testsuite.features.js index 0982447..4090f7e 100644 --- a/test/node/testsuite.features.js +++ b/test/node/testsuite.features.js @@ -62,6 +62,8 @@ describe('makeHtml() features testsuite', function () { converter = new showdown.Converter({encodeEmails: false, simplifiedAutoLink: true}); } else if (testsuite[i].name === '#331.allow-escaping-of-tilde') { converter = new showdown.Converter({strikethrough: true}); + } else if (testsuite[i].name === 'enable-literalMidWordAsterisks') { + converter = new showdown.Converter({literalMidWordAsterisks: true}); } else if (testsuite[i].name === 'prefixHeaderId-simple') { converter = new showdown.Converter({prefixHeaderId: true}); } else if (testsuite[i].name === 'prefixHeaderId-string') { @@ -104,6 +106,8 @@ describe('makeHtml() features testsuite', function () { converter = new showdown.Converter({simplifiedAutoLink: true, strikethrough: true}); } else if (suite[i].name === 'disallow-underscores') { converter = new showdown.Converter({literalMidWordUnderscores: true, simplifiedAutoLink: true}); + } else if (suite[i].name === 'disallow-asterisks') { + converter = new showdown.Converter({literalMidWordAsterisks: true, simplifiedAutoLink: true}); } else { converter = new showdown.Converter({simplifiedAutoLink: true}); }