emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org2blog: get horizontal scrollbar on code examples?
@ 2020-04-04  9:34 Steinar Bang
  2020-04-04 10:33 ` Christian Moe
  0 siblings, 1 reply; 3+ messages in thread
From: Steinar Bang @ 2020-04-04  9:34 UTC (permalink / raw)
  To: emacs-orgmode

Does anyone know of a way to get horizontal scrollbars on code examples,
instead of line breaks?

I try to make code examples as horizontally compact, but sometimes
that's not enough, see e.g. some maven <dependency> elements here, and
the maven command line examples:
 https://steinar.bang.priv.no/2020/03/30/how-to-get-test-coverage-back-in-sonarcloud-maven-builds/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org2blog: get horizontal scrollbar on code examples?
  2020-04-04  9:34 org2blog: get horizontal scrollbar on code examples? Steinar Bang
@ 2020-04-04 10:33 ` Christian Moe
  2020-04-04 13:56   ` Steinar Bang
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Moe @ 2020-04-04 10:33 UTC (permalink / raw)
  To: Steinar Bang; +Cc: emacs-orgmode


Try adding

 .org-src-container .src { overflow: auto; white-space: nowrap }

to the CSS, e.g.:

  #+html_head_extra: <style>.org-src-container .src { overflow: auto; white-space: nowrap }</style>

Cheers,
Christian

Steinar Bang writes:

> Does anyone know of a way to get horizontal scrollbars on code examples,
> instead of line breaks?
>
> I try to make code examples as horizontally compact, but sometimes
> that's not enough, see e.g. some maven <dependency> elements here, and
> the maven command line examples:
>  https://steinar.bang.priv.no/2020/03/30/how-to-get-test-coverage-back-in-sonarcloud-maven-builds/



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org2blog: get horizontal scrollbar on code examples?
  2020-04-04 10:33 ` Christian Moe
@ 2020-04-04 13:56   ` Steinar Bang
  0 siblings, 0 replies; 3+ messages in thread
From: Steinar Bang @ 2020-04-04 13:56 UTC (permalink / raw)
  To: emacs-orgmode

>>>>> Christian Moe <mail@christianmoe.com>:

> Try adding

>  .org-src-container .src { overflow: auto; white-space: nowrap }

> to the CSS, e.g.:

>   #+html_head_extra: <style>.org-src-container .src { overflow: auto; white-space: nowrap }</style>

Thanks for the tip, Christian!

The "#+html_head_extra" example didn't work, because the SOAP and/or
wordpress HTML parser, strips off everything it doesn't like.

But I have wordpress premium, so I have the possibiliy of adding CSS: https://wp.me/PEmnE-Bt

I tried adding:
 .org-src-container .src {
 	overflow: auto;
 	white-space: nowrap;
 }

and that gave me a scrollbar, but unfortunately everything is put on a
single line.

Removing "white-space: nowrap" gives me the line feeds back, but also
loses the horisontal scroll bar.

According to what google tells me
 	overflow: auto;
should be enough to get scrollbars...?

The pre element has
    white-space: pre-wrap;
    word-wrap: break-word;
are those the problem?

Hm... https://www.w3schools.com/cssref/pr_text_white-space.asp ?

Tried:
 .org-src-container .src {
 	overflow: auto;
 	white-space: pre;
 }

Yep! That worked!

Needed to get the same formatting on command line examples as well, so I
ended up with: 
 .org-src-container .src, .example {
 	overflow: auto;
  	white-space: pre;
 }

Thanks again!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-04 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-04  9:34 org2blog: get horizontal scrollbar on code examples? Steinar Bang
2020-04-04 10:33 ` Christian Moe
2020-04-04 13:56   ` Steinar Bang

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).