facelessuser / MarkdownPreview

Markdown preview and build plugin for Sublime Text https://facelessuser.github.io/MarkdownPreview/
Other
405 stars 53 forks source link

Sane List ins't working? #78

Closed luispuerto closed 4 years ago

luispuerto commented 5 years ago

I think that python markdown sane list extension isn't working properly since the lists aren't rendering with the correct numbers:

1. one 
2. two 
3. three

Hello. How are you doing?  

4. four 
5. five 
6. six 

renders:

<article class="markdown-body"><ol>
<li>one </li>
<li>two </li>
<li>three</li>
</ol>
<p>Hello. How are you doing?  </p>
<ol>
<li>four </li>
<li>five </li>
<li>six </li>
</ol></article>

image

Perhaps am I missing something?

luispuerto commented 5 years ago

PS/ Sane List is in the extension list configuration file.

"markdown_extensions": [
        // Python Markdown Extra with SuperFences.
        // You can't include "extra" and "superfences"
        // as "fenced_code" can not be included with "superfences",
        // so we include the pieces separately.
        "markdown.extensions.footnotes",
        "markdown.extensions.attr_list",
        "markdown.extensions.def_list",
        "markdown.extensions.tables",
        "markdown.extensions.abbr",
        "pymdownx.betterem",
        {
            "markdown.extensions.codehilite": {
                "guess_lang": false
            }
        },
        // Extra's Markdown parsing in raw HTML cannot be
        // included by itself, but "pymdownx" exposes it so we can.
        "pymdownx.extrarawhtml",

        // More default Python Markdown extensions
        {
            "markdown.extensions.toc":
            {
                "permalink": "\ue157"
            }
        },
        "markdown.extensions.meta",
        "markdown.extensions.sane_lists",
        "markdown.extensions.smarty",
        "markdown.extensions.wikilinks",
        "markdown.extensions.admonition",
facelessuser commented 5 years ago

I'm not seeing this issue. When I use sane_lists, the second list (after the paragraph) starts with 4.

Are you sure you are running the correct parser? Make sure you are using the markdown parser and not the github parser, or some other. Also report any errors found in the console if you have any.

luispuerto commented 5 years ago

When I use sane_lists

Besides of having it on "markdown_extensions": [ on settings, do I need to have it enable somewhere?

Are you sure you are running the correct parser? Make sure you are using the markdown parser and not the github parser, or some other. Also report any errors found in the console if you have any.

Funnily... with GitHub parser the list correctly work and starts on 4, but not with the markdown parser.

This is the only thing warning in the console:

MarkdownPreview: Warning: The list format for JS is deprecated, please use the dictionary format.
List support will be removed in the future.

PS/ these are my settings https://gist.github.com/luispuerto/4f99edc9d891c3094ff3b248de0a9ab4 but I've tried removing all the settings —thus using the default ones— and the result was the same.

facelessuser commented 5 years ago

Apparently I am using an unreleased version of Python Markdown locally. When I downgraded to the current official release, it appears I am now getting the same behavior you are. I need to look into this more as I am currently confused why this isn't working.

facelessuser commented 5 years ago

It seems the issue is definitely specific to the current release of Python Markdown as when I jump back up to the the current unreleased tip of the dependency, the issue is no longer present. I'll probably sync the repo up to the current latest, along with pymdown-extensions, and release those dependencies after ensuring everything is working properly.

It will be easier to to probably just sync than figure out what went awry with the last release. I've been meaning to get the latest Python Markdown out anyways, but due to the extensive changes, I have to sync the pymdown-extensions release with it as there will be compatibility issues if I don't.

facelessuser commented 5 years ago

Okay, I understand what the issue is now. It turned out that lazy_ol used to be a global parameter that was fed into the Markdown class. lazy_ol was enabled by default, meaning that it would simply ignore the first number.

In the 3.0 series of Markdown (we are currently using 2.6.11) it was changed to have sane_lists control this as well as its other functionality. That is why we have this difference. These global parameters are not exposed in Markdown Preview, and since Markdown 3.0+ will do away with them, it doesn't make sense to add them.

Worst case scenario, I can backport this fix if pushing out the full 3.0+ takes me too long.

luispuerto commented 5 years ago

great to hear! 🙂

So I guess you are going to fix it soon, right? or do you need to wait till the release of the new python Markdown?

facelessuser commented 5 years ago

Current behavior is not a bug. So I'm viewing this more as a feature request. As for when it will get done, it will hopefully be soon, it all depends on my schedule and motivation.

Knowing that 2.6.11 is behaving as intended takes the urgency off though as I am no longer fixing a botched merge, but simply bringing new functionality provided by the latest version. I don't have to wait for a new release, I just need to carve out the time and motivation to get it done.

luispuerto commented 5 years ago

I don't know if it's really a bug or not... but the reality is we have in the "markdown_extensions": the "markdown.extensions.sane_lists" and it isn't rendering the list as expected when that extension is in use.

Anyhow... it's true that the problem isn't dire.

facelessuser commented 5 years ago

and it isn't rendering the list as expected when that extension is in use.

This is not a true statement. It is not rendering as expected when reading the current 3.0 documentation, but we are not using Python Markdown 3.0, we are using 2.6.11.

If you read 2.6.11 documentation, you'll find it is working exactly as described: https://github.com/Python-Markdown/markdown/blob/2.6.11/docs/extensions/sane_lists.md.

facelessuser commented 5 years ago

I hoping to upgrade the Python Markdown dependency very soon. When this is done, this should be fixed.

facelessuser commented 4 years ago

I've upgraded the Python Markdown library and Pymdown Extensions library. This should be fixed once systems upgrade the dependencies. If it doesn't update (it may take an hour or two to actually trigger an update) you can try running Satisfy dependencies from the control panel, and if everything installs okay in the console, restart Sublime.

luispuerto commented 4 years ago

Yeah! Now works perfectly. Thanks a lot!