hhlp
November 10, 2021, 10:06am
1
Inline code code → Normal Code
I’ve found this two solutions, both doesn’t works, I’m missing something or something changed in the meantime.
Inline code in Discourse’s markdown rendered is hardly discernible. Here’s a sequence of the word code with code formatting in every other occurrence: code code code code. It’s very hard to tell the difference.
Compare for instance with how it shows on Stack Overflow:
[image]
And it’s even more obvious on Slack.
How would one go about changing this so that inline code is noticeable?
Hi, currently inline code is gray-highlighted. How can I change this to make it more contrast with color text?
For instance like this:
[%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5]
vs
noticeable inline code
Regards,
Ivan
thx in advanced…
Regards.,
IAmGav
(Gavin Perch)
November 10, 2021, 10:13am
2
there are 4 settings in admin > settings that you would need to look at
I hope that helps
hhlp
November 10, 2021, 10:43am
3
I can’t see any diferences:
Default code language → auto
autohlighted languages → a list
show copy button to codeblock → activated
autohighted all code → activated
option not available code-fences.
I can’t install code-fences because is a business plan.
NOTE
I also adding plain-text to the list…
Regards.,
As OP mentioned, inline code can be highlighted. The method still works:
Go to https://example.com/admin/customize/themes/1/common/scss/edit (regarding your theme URL may differ)
Go to the bottom of the CSS section and paste the code below:
p>code, li>code {
color: #c7254e;
background: #f9f2f4;
padding: 2px 4px;
border-radius: 2px;
}
Save. Done. Your inline text looks like this:
this is for code blocks only (picture below). The original question was about inline text
hhlp
November 10, 2021, 12:04pm
5
thx for response I’ve tested your code before but I don’t know why doesn’t works in mi site:
Regards.,
Probably your theme is customized already and does not support this.
I use default theme (sorry for non-english text):
hhlp
November 10, 2021, 12:24pm
7
I’ve used the default color schema → light
Regards.,
I’ve just had a test on my site with Default Light theme, and it works for me. I had to refresh my page for it to display properly.
Did you add it as a new theme component? If so, did you remember to attach it to the theme? (pretty obvious, I know, but I forgot )
hhlp
November 10, 2021, 3:31pm
9
very glad to works here now, and thx for point me in the right directions, but some problem is here, a component which is apply the them has impediment the source works, when I’ve had a more clear idea was is the component I’ve wrote here.
Regards.,
hhlp
November 10, 2021, 3:38pm
10
I’ve found and this is the source:
→ discourse-custom-code/common at main · discourse/discourse-custom-code · GitHub
@import "common/foundation/variables";
@import "https://fonts.googleapis.com/css?family=#{$font}";
// --------------------------------------------------------------- //
code,
pre {
font-family: $font_family;
font-size: #{$font_size};
border-radius: #{$border_radius}px;
}
.hljs {
color: dark-light-choose($hljs_light, $hljs_dark) !important;
}
.hljs-comment,
.hljs-doctag {
color: dark-light-choose($comment_light, $comment_dark) !important;
}
This file has been truncated. show original
p > code,
li > code,
pre > code {
color: dark-light-choose($code_light, $code_dark) $i;
background: dark-light-choose($code_background_light, $code_background_dark) $i;
}
you can do it without tweaks CSS, just use that component and modify:
color light.
color background light.
code dark.
code background dark.
NOTE
however this works for both inline code and block-code.
Regards.,
Seems the proper link should be Custom Code