Docusaurus: Line highlight is not working in D2

Created on 10 May 2020  路  7Comments  路  Source: facebook/docusaurus

馃悰 Bug Report

Line highlight is not working in D2,

To Reproduce

(Write your steps here:)

code block:
```jsx {3}
function HighlightSomeText(highlight) {
if (highlight) {
return 'This text is highlighted!';
}

return 'Nothing highlighted';
}
```

Expected behavior

line 3 should be highlighted in the rendered codeblock.

Actual Behavior

image

Your Environment

  • Docusaurus version used:
    2.0.0-alpha.50

  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0):
    Google Chrome 81.0.4044.138-1

  • Operating system and version (desktop or mobile):
    Linux desktop

bug needs triage

All 7 comments

Can we see this code block live on hydra.cc?

Btw did you follow this section in the line highlighting docs?

To accomplish this, Docusaurus adds the docusaurus-highlight-code-line class to the highlighted lines. You will need to define your own styling for this CSS, possibly in your src/css/custom.css with a custom background color which is dependent on your selected syntax highlighting theme. The color given below works for the default highlighting theme (Palenight), so if you are using another theme, you will have to tweak the color accordingly.

Ah, I missed that.I was expecting to to work out of the box.

once I add the css block to my custom.css it works:
image

We added this line to the default custom.css in one of the recent versions but you didn't get updates for it.

Closing this out since not really a bug!

sounds good.
"didn't get updates for it" meaning it's just being delayed?

a related question:
I remember seeing something about specifying a filename for a codeblock in previous release notes. but I can't find it in the docs.
I am able to find title though. Is this the same feature?

image

"didn't get updates for it"

Nope, this file is cloned on init.

I am able to find title though. Is this the same feature?

Yes

Nope, this file is cloned on init.

Does it mean that if I recreate my website it would work without having to customize the css?

Yes kinda, if you ran the init command again and moved all your contents there. But I wouldn't advise to do that. This is probably the only change that we made to the skeleton custom.css.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

knowbody picture knowbody  路  23Comments

wez picture wez  路  26Comments

arifszn picture arifszn  路  24Comments

maximousblk picture maximousblk  路  23Comments

XavierNV picture XavierNV  路  24Comments