SublimeText-Markdown / MarkdownEditing

Powerful Markdown package for Sublime Text with better syntax understanding and good color schemes.
MIT License
3.19k stars 649 forks source link

add support for definition lists #97

Open CircleCode opened 10 years ago

CircleCode commented 10 years ago

definition lists are defined, for example, in php markdown extra, with this syntax:

term
:   definition

    definition continuation (because previous line begin with 4 spaces)

see http://michelf.ca/projects/php-markdown/extra/#def-list for full explanation.

currently, definition continuation is highlighted as code block while this is correctly highlighted for list continuation (see image below)

capture d cran de 2013-11-20 09 59 58

maliayas commented 10 years ago

Hmm, thanks for reporting.

In order to implement this, we need to add PHP markdown extra as a new flavor. For GFM, that's the expected behaviour.

As I check the page, PHP md extra has too many custom features. I wish these flavors merge one day ;)

CircleCode commented 10 years ago

I understand your answer (and to be honest, approve it in a certain way), but it seems to me that this syntax is a widely adopted one (not full php markdown extra, but the one for definition lists), see for example mmd supporting it: https://github.com/fletcher/MultiMarkdown/wiki/MultiMarkdown-Syntax-Guide#definition-lists or a python extension to markdown syntax: http://pythonhosted.org/Markdown/extensions/definition_lists.html

I also wish all those flavors will merge one day, but I think it is unlikely to be the case in short time…

maliayas commented 10 years ago

Do you mean we should implement it in "Markdown GFM"? If that is the case, I think it's not an appropriate solution. We need to sell what we advertise.

CircleCode commented 10 years ago

in fact, you're right that this has nothing to do in "Markdown GFM", and I don't know where it could be defined… <brainstorming allow-naive-questions-or-proposal="true"> is it possible in ST3 do define modular syntaxes? if yes, maybe we can explore this way with a "modular md" syntax? </brainstorming>

maliayas commented 10 years ago

Syntaxes in ST are pretty complicated. They can import each other for example; but it's unbelieveably easy to break things while fixing other things. And everything is regex based. Does "modular syntax" have a special meaning? I haven't heard it before.

maliayas commented 10 years ago

OTOH maybe we can create an all in one syntax that will support many flavors at once until the possible extend.

CircleCode commented 10 years ago

Does "modular syntax" have a special meaning? I haven't heard it before.

Nope, this is the way I tried to define a syntax where some parts could easily be activated or not

OTOH maybe we can create an all in one syntax that will support many flavors at once until the possible extend.

this is an interesting idea, but there is a danger of overlapping between syntaxes. maybe there must be a choice for each construct regarding its usage, its level of complexity to be implemented, and some other parameters…

maliayas commented 10 years ago

We can call these syntaxes modular. There is a repository feature for syntax definition. It works this way:

  1. You define your feature in the repository and give it an id.
  2. You import it in other parts using its id.

So it's easy to inject your module to other parts or comment out the include statement if you don't want it there.

I don't know if this helps what you want.

CircleCode commented 10 years ago

maybe we could write your suggested "many flavors md", and make each include dependant of an user option?

maliayas commented 10 years ago

Let's keep the bug open for some time too see what other people think. Syntax development consumes too much time, so we should choose the right path in the beginning. Thanks for starting the discussion.

CircleCode commented 10 years ago

yes, I think this is the best: let it open, and wait to see if people want this, and have some ideas on how to do this

mclearc commented 10 years ago

I would love to see this added, as it is also part of the pandoc 'flavor' markdown which I and many others use. See the description here. Pandoc is used heavily by academics, so it would be really great to see it supported in the MarkdownEditing Package. Unfortunately, I lack the skills to make any actual contribution to the coding side. The is a great Vim package here, (I'm transitioning from MacVim to Sublime Text 3) but I'm not sure the syntax highlighting code could be transferred to Sublime Text. In any case, MarkdownEditing is a great package, thanks for yours and Brett's efforts!

charlesroper commented 10 years ago

I just noticed this problem too. I am using MultiMarkdown syntax to edit Markdown Extra files and everything I've tried so far works great. Here's what the def list problem looks like:

http://i.imgur.com/346BL7U.png

Markdown Extra and Multimarkdown are pretty similar and certainly the definition lists syntax is the same, so could you not just add the multi-paragraph support to the MMD syntax?

maliayas commented 10 years ago

We now have plans to support Pandoc markdown. See #167

alexfornuto commented 10 years ago

I would also love to see definition lists defined. I was hoping to use your plugin to help work on a library of pages written in PHP Markdown Extra, but this limitation is a killer.