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

Change Background of inline code statements (backticks) #892

Open
Blackjacx opened this issue Sep 11, 2024 · 9 comments
Open

Change Background of inline code statements (backticks) #892

Blackjacx opened this issue Sep 11, 2024 · 9 comments
Labels
enhancement New feature or request

Comments

@Blackjacx
Copy link

Feature Name

Visibility of Inline Code Statements

Description

Hey ✌️

I wondered if it is possible to change the background of inline code statements to lets say gray like the GitHub style markdown is doing it. I was not able to find a DocC Website that has this :-(

I'm building my own and inline code is not very legible...

Motivation

Visibility of Inline Code Statements and my own DocC based "website". I use it as static site generator what works amazingly well.

Importance

No response

Alternatives Considered

No response

@Blackjacx Blackjacx added the enhancement New feature or request label Sep 11, 2024
@d-ronnqvist d-ronnqvist transferred this issue from swiftlang/swift-docc Sep 11, 2024
@d-ronnqvist
Copy link
Contributor

Does someone know if the code background already is configurable?

There are examples in the appearance customization documentation with custom background colors for the code blocks but I don't know if that's individually configurable.

@Blackjacx
Copy link
Author

Actually I'm setting these custom fill colors already (here), Effect can be seen here but the inline code statements are not affected.

@mportiz08
Copy link
Contributor

Very cool theme @Blackjacx!

From the provided links, I'm seeing that you have specified a color override which is being used for the code listing background, although maybe it was unexpected.

The color for the code listing background can be specified using the --code-color-background variable which should apply to all inline code listings.

By default (without overriding it), this value maps to another color variable called --color-fill-secondary. In your case, this color has been overwritten, so this value is being used by code listings.

So, you have 2 options to change this:

  1. Use an alternate color for --color-fill-secondary in your theme settings—this would apply to other places and not just code.
  2. Override --color-code-background in your theme settings, which should only apply to code listings.

Hope this helps! The theme you've created looks great so far to me.

@mportiz08
Copy link
Contributor

(It sounds like option 2 might be what you're looking for)

@Blackjacx
Copy link
Author

Uhh thanks for reaching out so quickly 👍 I'll try that asap!

@Blackjacx
Copy link
Author

Blackjacx commented Dec 10, 2024

Also another related question:

How to get actual syntax highlighting in code blocks? At the moment htis looks a bit sad when using the following block with shell or bash

xyz

Then on the website it renders as follows:

image

@mportiz08
Copy link
Contributor

Also another related question:

How to get actual syntax highlighting in code blocks? At the moment htis looks a bit sad when using the following block with shell or bash

xyz

Then on the website it renders as follows:

image

I would suggest contributing enhancements to highlight.js for the way that it tokenizes shell syntax, which is the npm package that we utilize for syntax highlighting purposes. Then we can pick up those enhancements here in Swift-DocC-Render while also benefiting the open source community in general.

I think it's pretty common for default shells on many systems to not syntax highlight different parts of command invocations, but I agree that it would be really great if there was a distinguishing colors for executables and arguments as one small example (like my preferred choice of shell does). It's probably not super trivial to make this kind of highlighting work in a way that is compatible with many/most shells though (bash/fish/zsh/etc), since I believe the highlight.js language is shell-agnostic and the syntax may differ between them.

@Blackjacx
Copy link
Author

Hey there,

thanks for the quick reply. We will see what we can do here 👍

As a quick fix we was that Swift syntax highlighting works quite well:

Our question today was:

Is there a documentation which syntax highlightings in markdown 
code blocks are currently supported?

@d-ronnqvist
Copy link
Contributor

Is there a documentation which syntax highlightings in markdown
code blocks are currently supported?

The Add Code Listings sections in the Swift-DocC documentation about formatting has a table that list the language identifiers that the renderer currently supports syntax highlighting for.

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

No branches or pull requests

3 participants