jrblevin / markdown-mode

Emacs Markdown Mode
http://jblevins.org/projects/markdown-mode/
GNU General Public License v3.0
875 stars 160 forks source link

Use markdown-css-paths as a file local variable #834

Closed mattiasb closed 1 week ago

mattiasb commented 1 week ago

Expected Behavior

I would like to set markdown-css-paths as a file-local-variable for use with markdown-export.

Actual Behavior

  1. The markdown-css-paths variables is marked unsafe which makes using it as a file local variable pretty unergonomic.
  2. The exported HTML doesn't import the stylesheet if set as a file local variable.

Steps to Reproduce

  1. Create a file test.md with the following contents:

    <!-- Local Variables: -->
    <!-- markdown-css-paths: ("./stylesheet.css") -->
    <!-- End: -->
    # Test #
    Test.
  2. Create a stylesheet.css in the same directory:

    h1 {
        padding: 10px;
    }
  3. Run normal-mode to make sure that the local variable is loaded and answer yes.

  4. Run markdown-export

  5. Observe the output:

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    <title>test.html</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    
    </head>
    
    <body>
    
    <!-- Local Variables: -->
    <!-- markdown-css-paths: ("./stylesheet.css") -->
    <!-- End: -->
    <h1 id="test">Test</h1>
    <p>Testa</p>
    
    </body>
    </html>

    Specifically: no reference to stylesheet.css.

Relevant values from custom.el

(custom-set-variables
  ...
 '(markdown-fontify-code-blocks-natively t)
 '(markdown-header-scaling nil)
 '(markdown-header-scaling-values '(1.9 1.6 1.3 1.1 1.0 1.0))
 '(markdown-open-command "/usr/bin/firefox")
 '(markdown-reference-location 'end)
 '(markdown-unordered-list-item-prefix "- ")
 '(markdown-use-pandoc-style-yaml-metadata t)
  ...
  )

Software Versions