Skip to content

Allow display prop on markdown span style #180496

Closed

Description

Style attribute added to span tags in #97793
Currently, it allows setting color and background-color but many times the background color doesn't apply because span is display: inline by default and doesn't have an actual width and height.
Adding display prop to the allowed styles will fix that and also will open up many other (safe) options for layoutting.

e.g, in pretty-ts-errors I had to use codicon classes to apply background-color and make things inlined. That classes bring unwanted styles like user-select: none that prevent selecting and copying the content.
Now it's a huge deal for tens of thousands of developers that can't copy the types from their errors.

CleanShot 2023-04-21 at 13 37 42@2x

I know that no one wants to keep adding styles to the sanitized regex and it opens the barrier for other requests like this but display prop is different. It is not a niche CSS prop, it is one of the most essential props in CSS and one of the few things that markdown can't do.

I made a pull request that add it, I hope it helps: #180498

Activity

  1. yoavbls commented on Jul 29, 2023

    @yoavbls
    ContributorAuthor

    Hi there!
    I just wanted to mention that JetBrains released their alternative solution
    and their code blocks are copyable.

    CleanShot 2023-07-29 at 19 40 35@2x

    We don't want to stay behind, It could be so nice if you'll approve this little line in my PR 🙏🏼
    https://github.com/microsoft/vscode/pull/180498/files

  2. added
    feature-request
    on Dec 12, 2023
  3. vscodenpa commented on Dec 13, 2023

    @vscodenpa

    🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

    Happy Coding!

  4. crkit-chan commented on Aug 27, 2024

    @crkit-chan

    Any new updates yet??

  5. dancherb commented on Dec 4, 2025

    @dancherb

    Hi there! I just wanted to mention that JetBrains released their alternative solution and their code blocks are copyable.

    CleanShot 2023-07-29 at 19 40 35@2x We don't want to stay behind, It could be so nice if you'll approve this little line in my PR 🙏🏼 https://github.com//pull/180498/files

    I saw this comment last week and it's what made me decide to finally move to Webstorm 🥲

  6. crkit-chan commented on Dec 4, 2025

    @crkit-chan

    You can use Custom CSS and JS loader for now

  7. added
    unreleased
    on Sep 14, 2026
  8. added
    insiders-released
    verification-needed
    and removed
    unreleased
    on Sep 15, 2026
  9. anthonykim1 commented on Sep 21, 2026

    @anthonykim1
    Contributor

    Verified on macOS 26.6.2 arm64 using VS Code Insiders 1.139.0-insider (c0f6c8cd52aeceb78b91631bce1b37d161a93d3f).

    I used a local test extension to render a realistic TypeScript diagnostic hover through the installed Insiders application.

    The hover displayed a missing-property error with supplied and required type structures. The supplied type fragment used a sanitized span with display:inline-block, a selection background color, and rounded corners.

    Verified:

    • The extension-provided Markdown rendered in a normal editor diagnostic hover.
    • The highlighted type fragment retained display:inline-block.
    • Its computed display value was inline-block.
    • The multiline username and email fields rendered as one rectangular highlighted block.
    • The highlighted content remained selectable.
    • Selecting the span returned both username: string and email: string.
    • The span did not receive user-select: none.

    Results:

    • Extensions can use display:inline-block to create structured Markdown highlights in editor hovers.
    • The highlighted diagnostic content remains selectable and copyable.
    • Extensions no longer need unrelated Codicon classes to obtain an inline-block layout.

    The missing display:inline-block Markdown span support no longer reproduces in current Insiders.

    Realistic TypeScript diagnostic hover with selectable inline-block highlighted type content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apifeature-requestinsiders-releasedverification-neededverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions