sparksuite / simplemde-markdown-editor

A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://simplemde.com
MIT License
9.92k stars 1.12k forks source link

underline titles don't affect the title itself #412

Open atsepkov opened 8 years ago

atsepkov commented 8 years ago

In markdown, the following are equivalent:

# Title 1
Title 1
=====

## Title 2
Title 2
-------

But in simpleMDE the underline only turns itself into a title, not the line before.

WesCossick commented 8 years ago

Here's what it looks like.

screen shot 2016-08-04 at 10 07 41 am

This appears to be a bug with CodeMirror, which does the Markdown parsing while editing.

WesCossick commented 8 years ago

You'll probably want to submit an issue in their repo: https://github.com/codemirror/CodeMirror.

atsepkov commented 8 years ago

I'm confused, could I get a little more detail? I'm still new to simpleMDE and trying to understand how it works. I understand that your editor is built on top of CodeMirror but what is it in their code that forces this bug on simpleMDE? Are you leveraging their syntax highlighter for markdown and overriding the stylesheet?

brondsem commented 8 years ago

SimpleMDE mostly adds the toolbar and some configuration. CodeMirror implements the main markdown formatting. The issue is here, including a workaround: https://github.com/codemirror/CodeMirror/issues/2143

atsepkov commented 8 years ago

Thanks @brondsem , that worked. @WesCossick , I would recommend that this workaround be merged into SimpleMDE, because in the context of CodeMirror it could be argued that it's not a bug, since visually it's still clear that it's a title. But in SimpleMDE, where the size grows, this does manifest as a bug.

WesCossick commented 8 years ago

I'll look into implementing the workaround. Thanks @brondsem.