facelessuser / MarkdownPreview

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

Code blocks are ignoring language syntax highlighting and newlines #178

Closed rkyathappala closed 3 months ago

rkyathappala commented 4 months ago

I just installed on ST3 today, havent looked at all documentation/issues. but after working a while to get the mathjax equation support to work I noticed that the code block is ignoring the syntax highlighting for my basic c++ block, as well as ignoring the new lines in the code i wrote.

I appreciate the project, and thanks for the support!

My example is Test-subl.md which yields: image

facelessuser commented 4 months ago

Please provide your settings.

rkyathappala commented 4 months ago
{
    /*
        Enable mathjax support for LaTeX formulas

        To keep other extensions active, you can specify in the place of //etc..
    */
    "enable_mathjax": true,
    "js": [
        "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML",
        "res://MarkdownPreview/js/math_config.js",
    ],
    "markdown_extensions": [
        "markdown.extensions.extra",
        {
            "pymdownx.arithmatex": {
                "generic": true
            }
        },
        {
            "markdown.extensions.toc": {
                "permalink": "\ue157"
            }
        }
        //---- etc.
    ]
}
rkyathappala commented 4 months ago

Please provide your settings.

{
    /*
        Enable mathjax support for LaTeX formulas

                To keep other extensions active, you can specify in the place of //etc..
    */
    "enable_mathjax": true,
    "js": [
          "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML",
          "res://MarkdownPreview/js/math_config.js",
        ],
        "markdown_extensions": [
          "markdown.extensions.extra",
          {
              "pymdownx.arithmatex": {
                  "generic": true
              }
          },
          {
              "markdown.extensions.toc": {
                  "permalink": "\ue157"
              }
          }
          //---- etc.
        ]
}
facelessuser commented 4 months ago

//--- etc. doesn't help me see what is wrong, so let me say this, when you override plugins in your personal settings, you override all plugins, so make sure you include any and all that you wish to use. If you want syntax highlighting in blocks, you need to have pymdownx.superfences in your plugin list. Look at the default settings and copy them over to your user settings.

rkyathappala commented 3 months ago

//--- etc. doesn't help me see what is wrong, so let me say this, when you override plugins in your personal settings, you override all plugins, so make sure you include any and all that you wish to use. If you want syntax highlighting in blocks, you need to have pymdownx.superfences in your plugin list. Look at the default settings and copy them over to your user settings.

Yep that fixed it, thanks!

I had kept the //etc in there from the mathjax thread I was following on stackOverflow.

In the future if I find a specific md feature not working as I expect it where should I look to figure out the specific md extension name so I can copy it over to my user setttings?

Or would it just be better practice to copy over all the md extensions in the default settings?

facelessuser commented 3 months ago

Or would it just be better practice to copy over all the md extensions in the default settings?

I would copy everything over and only emove the things you don't want.