MMMarkdown icon indicating copy to clipboard operation
MMMarkdown copied to clipboard

Request: ability to turn off Setext-style headers and non-fenced code blocks

Open iosdev-republicofapps opened this issue 9 years ago • 4 comments

Hi,

Would you be open having two options added to MMarkdownExtensions:

  1. MMMarkdownExtensionsNoSetextHeaders: Disable detection of headers like
A Setext Header
=============

and instead only allow the

# Atx Style Headers
  1. MMMarkdownExtensionsNoSpaceIndentedCodeBlocks: Disable detection of code blocks preceded by four spaces as in:
    This would no longer be a code block.

and instead allow fenced code blocks (if MMMarkdownExtensionsFencedCodeBlocks is enabled).

I ask because I'm making a user-facing Markdown app and I want to avoid confusion amongst my users about whether to use the # (Atx) or === (Setext) headers. I also want to avoid confusion about space-indented code blocks.

Also, turning off Setext headers and space-indented code blocks makes Markdown syntax highlighting within the markdown input editor much easier.

I think this would be two simple changes in MMMarkdown.h and MMParser.m.

If I was willing to make these code changes, including automated tests, on a fork, would you be open to a pull request to merge this into the master branch? :-)

I'm really enjoying MMMarkdown (thanks!) and I need these two new flags but I'd rather avoid forking and diverging my own version from your master since that will make subsequent updates to your later releases more difficult and require git merges, etc.

In my experience, use of Setext headers is rare since they only have 2 levels of headers (compared to 6 for Atx). Also, fenced code blocks seem far more popular than space-indented ones in my experience.

Thanks and best wishes.

iosdev-republicofapps avatar Jan 28 '15 01:01 iosdev-republicofapps

I'm going to take a couple days to think about it, but I think I'm probably okay with doing this.

mdiep avatar Jan 29 '15 01:01 mdiep

Awesome, thanks! :-)

iosdev-republicofapps avatar Jan 29 '15 02:01 iosdev-republicofapps

I'm okay with this approach if you want to open a PR. :relaxed:

mdiep avatar Jan 30 '15 20:01 mdiep

Thanks! Will do.

iosdev-republicofapps avatar Jan 30 '15 21:01 iosdev-republicofapps