ancane / markdown-preview-mode

Minor mode to preview markdown output as you save
GNU General Public License v3.0
165 stars 23 forks source link

Hardcoded Stylesheet in .markdown-preview.html #15

Closed vanderheijden86 closed 7 years ago

vanderheijden86 commented 7 years ago

Altough I change the style sheet by customizing markdown-preview-style, I still am not able to get the right stylesheet connected in the preview. I check this out and in the .html file the link to the standard thomasf.github stylesheet is present. Can you help me out? Thanks a lot.

ancane commented 7 years ago

Hey. Strange but customizing style var works on my machine. Lets see. Stylesheet file is coded into -preview.html file for sake of default css for the page only. It is replaced by the style var after page is connected to emacs buffer. So, here are 2 options possible: javascipt error seen in browser console, which prevents from replacing stylesheet tag, or it's variable to blame, meaning new value didn't apply. If you find nothing strange in the browser console, then please check the output of M-x describe-variable RET markdown-preview-style RET.

vanderheijden86 commented 7 years ago

Hi, thanks for the fast reply. No browser erros, it's value is:

markdown-preview-style is a variable defined in `markdown-preview-mode.el'. Its value is "https://sindresorhus.com/github-markdown-css/github-markdown.css"

vanderheijden86 commented 7 years ago

When I inspect with Chrome I see that the stylesheet value in the header is updated to reflect the correct link, however the actual styles are not applied to the elemens (h1, h2 etc). Strange...

vanderheijden86 commented 7 years ago

Figured it out :-). When I change "<article id=", to "<article class=" it works. Apparently markdown changed from setting the id of the article to setting the class.

screen shot 2016-09-23 at 11 20 36
ancane commented 7 years ago

I see. It's a github markdown css file. I guess, this css should be paired with appropriate markdown processor.

vanderheijden86 commented 7 years ago

One quick question, do you know how I can pair the right processor? I can't find a markdown binary which does exactly render like github. Instead I use a command line utility named grip now. Can I hook this up with markdown-preview-mode?

ancane commented 7 years ago

Sure. That's done via customizing markdown-command variable.

ancane commented 7 years ago

I guess, thanks to @zenkiezhu this can be closed now.