Skip to content

Conversation

@atusy
Copy link
Collaborator

@atusy atusy commented Jul 7, 2019

This PR is a generalization of a0c0c68 (#1471)

Currently, JS converts background-color and color properties of div.sourceCode to pre.sourceCode and delete the formers iff the both properties are specified for div.sourceCode

Thus, highlight: tango with theme: darkly clearly shows that div.source {background: f8f8f8} is active.
(tango only specified background-color not color)

div.sourceCode
  {  background-color: #f8f8f8; }

image

By this PR, output becomes

image

Source

---
output:
  html_document:
    theme: darkly
    highlight: tango
---

Corners of code block looks like squared due to background colors of `div`.

```r
"Hello, Rmd"
```

Line numbers have background colors because it is within `div.sourceCode`

```{.numberLines}
"Hello, world"
```

Code blocks with no class attributes are unaffected

```
"Hello, world"
```

@atusy
Copy link
Collaborator Author

atusy commented Jul 7, 2019

Note: kate is the only highlighting theme which does not work well with theme that has background colors.

image

This is because of following css embedded by pandoc.

pre.numberSource code > span > a:first-child::before
  { content: counter(source-line);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
    background-color: #ffffff;
    color: #a0a0a0;
  }

atusy added a commit to atusy/rmarkdown that referenced this pull request Jul 7, 2019
@yihui yihui added this to the v1.14 milestone Jul 10, 2019
Copy link
Contributor

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be reasonable. Thank you!

@yihui yihui merged commit 13864b3 into rstudio:master Jul 10, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants