thegeeklab / hugo-geekdoc

Hugo theme made for documentation

Home Page:https://geekdocs.de

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Codeblock copy adds empty lines

alpreu opened this issue · comments

Hi, I'm running into an issue where using the copy-button from a codeblock adds empty lines to the copied text.

Example codeblock:

docker run --name justanexample \
  -p 8080 \
   abcde:0.1.0

Output after using the copy-button:

docker run --name justanexample \ 

-p 8080 \

 abcde:0.1.0

Unfortunately that breaks bash commands when adding multi-line scripts. Is there some configuration I can set to prevent it from happening?

Geekdoc version: v0.39.4

Thanks for your report.

Can you please test the latest release and let me know what browser you use? I can't reproduce it on Firefox and Chrome using the latest version.

Can you please test the latest release and let me know what browser you use? I can't reproduce it on Firefox and Chrome using the latest version.

Same issue on the latest release :(
I'm using Chrome 118.0.5993.88 on macOS 13.3.1

Hmm, strange, I have no idea how to debug it further.

screencast.webm

Very strange indeed. On the geekdocs website itself it works for me but it does not on my site using hugo server and neither on our netlify deployment

Ok so this doesn't seem to be a browser/client issue I can reproduce it with your deployment as well. Is the source for this deployment accessible somewhere as well?

I know it worked before so I went through our latest changes and found the culprit:

(in hugo.toml)

[markup.goldmark.renderer]
unsafe = true # Allow HTML in md files

However, if I remove this one, then my images don't work anymore. The way I include them is like this in the .md file:

<img src="streamvisor-box.svg" alt="streamvisor all-in-one logo" height="50"/>

and the .svg file itself is placed in the same directory as the .md file - Is this wrong somehow? I remember we did it like this because it allowed us to resize the image inside the tag

Thanks! Good find, will take a closer look.

Hmm, I stuck again... We use the unsafe renderer for geekdocs.de as well, see https://github.com/thegeeklab/hugo-geekdoc/blob/main/exampleSite/config/_default/config.yaml#L21 and even with that setting everything works as expected.

Which Hugo version do you use?

After spending some time with it today I was able to fix it by moving the goldmark config to the very end of our hugo.toml.

In case you still want to reproduce the issue, this was the state of the hugo.toml where it would break before

baseURL = ""
relativeURLs = "True"
languageCode = 'en-us'
title = 'Streamvisor Docs'
theme = 'hugo-geekdoc'

[markup.goldmark.renderer]
  unsafe = true # Allow HTML in md files

# Geekdoc required configuration
pygmentsUseClasses = true
pygmentsCodeFences = true
disablePathToLower = true

pluralizelisttitles = false

# Required if you want to render robots.txt template
enableRobotsTXT = true

[params]
  geekdocCollapseAllSections = true
  geekdocToC = 3
  geekdocDarkModeToggle = false

Argh... This sounds like a Hugo issue then, the order of the config values should not matter. Glad you found it, and thanks for letting me know.

Sure, also thanks a lot for being so responsive. Very much appreciated!