revolunet / sublimetext-markdown-preview

markdown preview and build plugin for sublime text 2/3
MIT License
2.31k stars 362 forks source link

YAML Settings Override #369

Closed s7726 closed 6 years ago

s7726 commented 7 years ago

---
title: Test Doc
settings:
    skip_default_stylesheet: true

---

Using the proceeding along with "strip_yaml_front_matter": true, (or false) in my MarkdownPreview.sublime-settings file I can't get the settings to be overridden.

Ultimately I want to override the template as well, but I moved to just trying this after I realized part of my problem could have been how I'm passing the path.

Is there a trick I'm not seeing?

facelessuser commented 7 years ago

Have you tried setting skip_default_stylesheet in your settings? What I am curious about is whether skip_default_stylesheet is working as expected, or is it actually not overriding the original setting. If skip_default_stylesheet doesn't respond as you expect when not using yaml frontmatter, then the problem is probably not the frontmatter, but either the understanding of the setting's use, or an actual issue with the setting.

s7726 commented 7 years ago

Without any YAML at the beginning of my document and with skip_default_stylesheet set to true in my user settings file. The previewed document still ends up with the default stylesheet in the document and it is applied. I would expect to see a difference in formatting of the previewed document between skip_default_stylesheet: true and skip_default_stylesheet: false The browser, enabled_parsers, and markdown_filetypes settings in my user settings file all work as expected.

facelessuser commented 7 years ago

Okay, then it is probably an issue with the setting, or the understanding of how the setting works, and not the YAML override. I will take a look a the setting when I get some time and see if there is something that isn't obvious and undocumented about it. Maybe there is a bug.

s7726 commented 7 years ago

Any movement on this? skip_default_stylesheet doesn't seem to have any effect from either the settings file or YAML in the document. With "strip_yaml_front_matter": false the "settings" section in the YAML is converted to a named meta tag in the output html <meta name="settings" content=",skip_default_stylesheet: true">

facelessuser commented 7 years ago

@s7726, sorry this has been low priority for me. I've been meaning to take a look at some of these issues, I've just had other things I've had to attend to.

If I can, I'll try to get back to this in the next couple of days. If I don't get to it by the end of the week, feel free to ping this thread again.

s7726 commented 7 years ago

Digging a little deeper it appears skip_default_stylesheet has no affect unless html_template is set. html_template has to be set to a fully qualified path. I think this could be workable if it was modified to accept a relative path from the in document YAML. Either way it's confusing that you have to use a custom template to not have the default stylesheet.

I would expect to be able to have:

test.mmd

---
title: Test
settings:
    skip_default_stylesheet: true
---

# Test File

And then be able to setup my own css in test.css (via "allow_css_overrides": true) but have it use the normal default template.

The css setting would also be helpful to take relative paths when parsed from the YAML.

facelessuser commented 7 years ago

Yeah, I'll take a look at that. I didn't design the part about skip_default_stylesheet, but I vaguely remember people asking questions about it before which is why I had mentioned there might be a misunderstanding of how it worked.

On top of possibly reworking this setting, I really think this project needs a documentation site. Even if the behavior of skip_default_stylesheet remains the same, I think some actual organized documentation would be helpful. Currently, the settings file is the documentation.

facelessuser commented 6 years ago

This will be covered by #393