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

support clipping (or scrolling) long errors #662

Open
erikerlandson opened this issue Jul 10, 2022 · 7 comments
Open

support clipping (or scrolling) long errors #662

erikerlandson opened this issue Jul 10, 2022 · 7 comments
Labels

Comments

@erikerlandson
Copy link

I have a code block that creates an error, but the long length of the error is a bit distracting.
Is there a way to tell mdoc to clip the error message to the first n lines, or just tell it to have a maximum code block height,
with a scroll bar? Setting something like mdoc:height=10 doesn't fix this particular problem.

Screen-shot of my long error:

image

@erikerlandson
Copy link
Author

cc @armanbilge

@armanbilge
Copy link
Contributor

armanbilge commented Jul 10, 2022

@erikerlandson do you have a branch I can look at? We can support this at the rendering level by adding a custom CSS style.

Basically something like this:

pre {
  max-height: 100px;
  overflow: scroll;
}

@erikerlandson
Copy link
Author

@armanbilge latest is merged into scala3 branch:
https://github.com/erikerlandson/coulomb/blob/scala3/docs/index.md

@armanbilge
Copy link
Contributor

@erikerlandson
Copy link
Author

@armanbilge thanks!

For reference, what I ultimately ended up doing was this:

/* when mdoc renders "long" comments, clip them and provide a scrollbar */
.comment {
  /* set display as block or the other settings don't work */
  display: block;
  /* most comments are short, and display normally */
  max-height: 100px;
  /* add a scrollbar only when necessary */
  overflow: auto;
}

Which adds a scrollbar only for "long" comments, like this:

image

@erikerlandson
Copy link
Author

erikerlandson commented Jul 10, 2022

Might be useful to have a special class for "multi-line-comment" or "mdoc-output-comment" to distinguish between comments the programmer wrote and comments generated by mdoc itself.

Or some new mdoc tag. ```scala mdoc:maxoutputlines=3:overflow=scroll:fail

@erikerlandson
Copy link
Author

Possibly not related but now seeing this strange behavior:
erikerlandson/coulomb#309

@tgodzik tgodzik added the spree label Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants