facelessuser / MarkdownPreview

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

Looks completely different #7

Closed sebastienbarre closed 6 years ago

sebastienbarre commented 6 years ago

Hi.

Not sure if I can state the issue any better here, but after browsing through a dozen issues in the old repo, and trying to read the documentation for the 2.0 version, I still don't get why the rendered output looks so different.

This is especially true when it comes to rendering code/languages.

It's like old CSS defaults are pretty much gone.

What... happened?

facelessuser commented 6 years ago

Different in what ways, do you have some examples?

sebastienbarre commented 6 years ago

I wish, but thanks to Sublime, reverting to previous package version to give you a before/after is really not a user-friendly task...

Is syntax highlighting gone?

sebastienbarre commented 6 years ago

My key bindings was:

{ "keys": ["alt+m"], "command": "markdown_preview", "args": {"target": "browser", "parser":"markdown"} }

which I changed to

{ "keys": ["alt+m"], "command": "markdown_preview", "args": {"target": "browser", "parser":"github"} }

This improved some layout issues with code rendering. Definitely has a different feel to it, but I would need to track the changes you made to the default CSS.

facelessuser commented 6 years ago

Syntax Highlighting

Ahh, syntax highlighting default was left out by accident. My user settings had it, so I missed it in the defaults.

This will be added back in a bugfix release.

You can either add CodeHilite:

    "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.smart_strong",
        "markdown.extensions.footnotes",
        "markdown.extensions.attr_list",
        "markdown.extensions.def_list",
        "markdown.extensions.tables",
        "markdown.extensions.abbr",
        // 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",
        "markdown.extensions.codehilite",  <-----------add

Or use pymdownx.extensions.highlight. With this one you'll also want to change pygments_css_class to highlight.

    /*
        This is the class to prepend to the pygments CSS styles. Make sure it matches whatever class(es)
        you've specified in the extension that controls Pygments highlighting.  CodeHilite's default is
        "codehilite".
    */
    "pygments_css_class": "highlight",
    "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.smart_strong",
        "markdown.extensions.footnotes",
        "markdown.extensions.attr_list",
        "markdown.extensions.def_list",
        "markdown.extensions.tables",
        "markdown.extensions.abbr",
        // 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",
        "pymdownx.extensions.highlight",  // <--------------add
sebastienbarre commented 6 years ago

OK I solved it, so here is what is going on.

Sublime seems to have updated Markdown Preview to 2.0 (as expected). But in the process, it appears the default settings (Preferences -> Packages Settings -> Markdown Preview -> Settings - Default) were completely wiped. There were zero settings there. Hence the very weird output.

I uninstalled Markdown Preview, then reinstalled, and all the defaults settings are back. It now looks the same as it used to.

Something to keep in mind if somebody else reports such issue: uninstall and reinstall.

facelessuser commented 6 years ago

Sublime seems to have updated Markdown Preview to 2.0 (as expected). But in the process, it appears the default settings (Preferences -> Packages Settings -> Markdown Preview -> Settings - Default) were completely wiped. There were zero settings there. Hence the very weird output.

Yeah, it was renamed to MarkdownPreview instead of Markdown Preview. Probably just a side effect of the rename process.

zsiegel92 commented 6 years ago

I wouldn't call this issue "closed". Most (possibly all) packages generate a folder in Application Support > Sublime Text 3 > Packages with the package name, in which the .sublime-settings file resides.

SublimeText thinks this folder exists, and lists it on the top of the window when Packages Settings > Markdown Preview > Settings - Default is opened.

Of course SublimeText is getting the default settings from somewhere when that menu item is selected, which turns out to be inside of the zipped Sublime Text 3 > Installed Packages > MarkdownPreview.sublime-package directory.

This is not just a name switch. SublimeText is interacting with this package in a way that is wrong re: settings.

I wonder if anything can be done! I hope this comment helps in some way and doesn't just bog down @facelessuser . Thanks.

facelessuser commented 6 years ago

I wouldn't call this issue "closed". Most (possibly all) packages generate a folder in Application Support > Sublime Text 3 > Packages with the package name, in which the .sublime-settings file resides.

Not true. Zipped packages are default unless you specify it in your package. I support a lot of packages, so I am very familiar with this mechanic.

SublimeText thinks this folder exists, and lists it on the top of the window when Packages Settings > Markdown Preview > Settings - Default is opened.

This is a carry over from renaming the package from Markdown Preview to MarkdownPreview. Package Control likely didn't clean it up, so if it is present, you'll have to clean it up. If it is linking to a folder Markdown Preview it is because Sublime is seeing an override somewhere (cached?), but it isn't because of this package.

While I forgot to rename the menu entry, it points to the correct folder name which Sublime resolves to the zipped version for default and User folder version for user settings.

{
                        "caption": "Markdown Preview",
                        "children":
                        [
                            {
                                "command": "open_file",
                                "args": {"file": "${packages}/MarkdownPreview/MarkdownPreview.sublime-settings"},
                                "caption": "Settings – Default"
                            },
                            {
                                "command": "open_file",
                                "args": {"file": "${packages}/User/MarkdownPreview.sublime-settings"},
                                "caption": "Settings – User"
                            },
                            { "caption": "-" }
                        ]
                    }

I am seeing absolutely no issues with menus currently on any system.

Maybe I am misunderstanding your issue. You can try and unistall and reinstall the package and see if that helps, but the package no longer references the old named location.

zsiegel92 commented 6 years ago

Thanks for the insight! I did remove and reinstall several times, restarted my computer, etc.

I will accept your explanation that Package Control is caching something.

Thanks for the response.

facelessuser commented 6 years ago

I will probably do another release and change the menu caption to MarkdownPreview. If there is a cache somewhere, you would then see two entries one for MarkdownPreview and one for Markdown Preview. I will also use the unified menu (user and default in one window). Anyways, it should be clear then if you are seeing the new menu.