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 scroll bar in markdown code snippet #111

Open
jacoporepossi opened this issue Jun 17, 2023 · 2 comments
Open

Change scroll bar in markdown code snippet #111

jacoporepossi opened this issue Jun 17, 2023 · 2 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@jacoporepossi
Copy link

Hi there,

I have a question regarding markdown code snippets. I wonder how I could avoid text overflow so that the text is more legible.

Here's my current situation:
image

I'd love to have automatic text wrap. How could I achieve that?
Is it also possible to add colors in text?

@jacoporepossi
Copy link
Author

I think I solve it adding white-space: pre-wrap in the _base.scss file

/**
 * Code formatting
 */
pre,
code {
  @include relative-font-size(0.9375);
  color: $text-color;
}

*:not(pre) > code {
  padding: 3px 6px;
  border-radius: 3px;
  background-color: #eee;
  margin: 0 5px;
}

pre {
  overflow-x: auto;
  white-space: pre-wrap;    <--------- here
  position: relative;
  background-color: #f0f0f0;

I still don't how how I could add text formatting inside a code block though

@jeffreytse jeffreytse self-assigned this Jun 26, 2023
@jeffreytse jeffreytse added the good first issue Good for newcomers label Jun 26, 2023
@jeffreytse
Copy link
Owner

Hi @jacoporepossi

Thanks for the questions. In factor, the code block is used to show code in their raw format, which means do not add behavior of word wrap. But you can make the behavior by the following code snippet in the _base.scss file:

code.hljs.plaintext {
    white-space: pre-wrap;
}

Thanks & Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants