Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add provided classes to wrapper div #71

Open
duckwork opened this issue May 21, 2019 · 2 comments
Open

Add provided classes to wrapper div #71

duckwork opened this issue May 21, 2019 · 2 comments

Comments

@duckwork
Copy link

With a source like this:

``` {.python .numberLines}
if is_true:
    pass
```

pandoc generates

<div class="sourceCode" id="cb1"><pre class="sourceCode python try"><code class="sourceCode python"><a class="sourceLine" id="cb1-1" title="1"><span class="cf">if</span> is_true:</a>
<a class="sourceLine" id="cb1-2" title="2">    <span class="cf">pass</span></a></code></pre></div>

I'd like the enclosing <div> to include the classes I've specified in the source (or at least python.) I'm thinking of changing the style of different code blocks based on which language they are.

I've traced the issue to skylighting, in the formatHtmlBlock function. I think all that's needed is a change in the first line:

  H.div ! A.class_ (toValue "sourceCode") $

to

  H.div ! A.class_ (toValue $ Text.unwords classes) $

I'm writing this as an issue to see if there'd be interest in a pull request for this change.

@dbaynard
Copy link
Contributor

dbaynard commented May 26, 2019

The div is only there to fix a spacing issue. Can you just change the style of the pre?

@duckwork
Copy link
Author

The issue comes in when adding background colors. Say I want to color all python blocks as blue and all bash as green, while everything else is black. Currently, it looks like this jsfiddle. With the proposed change, it'll look like this one. Note how in the first fiddle, also, the code lines are only highlighted to the end of each code line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants