Why does Stack Exchange's WMD Editor allow you to do things like bold parts of sentences while the Open Source PageDown (https://github.com/StackExchange/pagedown) does not?

  • 5
    Possible duplicate of Markdown change: Intra-word emphasis now works – Sonic the Masked Werehog Mar 15 '18 at 16:53
  • 1
    @Ano Does that post explain why the change is not made in PageDown? – user315433 Mar 15 '18 at 16:54
  • 3
    @FTP That's off-topic for this site. – Sonic the Masked Werehog Mar 15 '18 at 16:54
  • 1
    @Ano The software that powers Stack Exchange sites is on topic here. PageDown description says "The Markdown editor and converter used on Stack Overflow and the other Stack Exchange sites" – user315433 Mar 15 '18 at 17:06
  • 1
    @Ano I dunno, it's an official Stack Exchange library that's very of-interest to some users working on integrated tools. Being able to consistently render posts in the same way as the site was a specific question I just asked for archival purposes, and this is vey related. – Jeremy Banks Mar 15 '18 at 17:07
  • 1
    Are you sure it’s not available in PageDown? A quick search shows there is an asteriskIntraWordEmphasis option that enables _DoItalicsAndBold_AllowIntrawordWithAsterisk in Markdown.Converter.js – Cai Mar 15 '18 at 17:38
  • 2
    @Cai wow, you're completely correct. This enables intra-word emphasis. Thank you so much! – Apollo Mar 15 '18 at 17:57
  • @Cai I answered it. – Sonic the Masked Werehog Mar 15 '18 at 21:33

There is an option called asteriskIntraWordEmphasis in Markdown.Converter.js which needs to be set to enable the intra-word emphasis. You pass the options when creating the converter object, so you can enable it by doing something like this:

var converter = new Markdown.Converter({asteriskIntraWordEmphasis: true});

I just tested this using the demo and it seems to work as expected.

You can see this is how it is enabled on the editor here too (in wmd.en.js) and that it's stored as a setting on the StackExchange object like so:

var converter = new Markdown.Converter({
    nonAsciiLetters: true,
    asteriskIntraWordEmphasis: StackExchange.settings.markdown.asteriskIntraWordEmphasis,
    autoNewlines: StackExchange.settings.markdown.autoNewlines,
    linkEmails: StackExchange.settings.markdown.linkEmails
| improve this answer | |

Per Cai in the comments:

It is actually possible in PageDown, but is disabled by default. There is an option called asteriskIntraWordEmphasis that enables _DoItalicsAndBold_AllowIntrawordWithAsterisk. The change mentioned at Markdown change: Intra-word emphasis now works was probably implemented just by enabling this option.

| improve this answer | |

In Markdown.Converter.js, changing this line:

var _DoItalicsAndBold = OPTIONS.asteriskIntraWordEmphasis ? _DoItalicsAndBold_AllowIntrawordWithAsterisk : _DoItalicsAndBoldStrict;


var _DoItalicsAndBold = _DoItalicsAndBold_AllowIntrawordWithAsterisk;

enables intra-word emphasis!

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .