Giter VIP home page Giter VIP logo

Comments (14)

alexvoss avatar alexvoss commented on June 19, 2024 1

Please do help us investigate the problem by creating a minimal reproduction. This helps us rule out that it is a customization that is causing the issue for you. Also need to see what versions of things you are using. I have created a long line in one of my code examples and could not reproduce the problem.

There is a chance this is not an issue with Material for MkDocs but I'd be happy to have a look and narrow it down.

from mkdocs-material.

squidfunk avatar squidfunk commented on June 19, 2024 1

Thanks for reporting and providing the reproduction! Turns out we already fixed this in Insiders when we implemented content.code.select, but forgot to merge this tiny fix into the community edition. The fix mandates that the line_spans setting of pymdownx.highlight is enabled, because otherwise it is just not possible with plain CSS to stretch highlighted lines to the entire width – the markup doesn't allow it. Thus, the configuration in mkdocs.yml needs to be:

markdown_extensions:
  - pymdownx.superfences
  - pymdownx.highlight:
      line_spans: __span

With line_spans enabled, and the fix I just pushed in 9d33f8a, the problem should be gone.

from mkdocs-material.

squidfunk avatar squidfunk commented on June 19, 2024 1

Additional note: I just checked and we already recommend setting line_spans in the code block configuration. It's always a good idea to check the recommended configuration of the components you're using, since they should include all of the necessary settings to get the most out of Material for MkDocs ☺️

from mkdocs-material.

squidfunk avatar squidfunk commented on June 19, 2024 1

No wait, you're right – the CSS was missing 😅 I mixed up the Insiders and community edition, stupid me. Fixed in 4eb1a43.

from mkdocs-material.

squidfunk avatar squidfunk commented on June 19, 2024 1

Released as part of 9.5.18.

from mkdocs-material.

lnxpy avatar lnxpy commented on June 19, 2024

Sorry if I haven't provided the exact required information. I feel like it's enough to report this bug as its reproduction is quite easy and straightforward. 🙏🏻

from mkdocs-material.

lnxpy avatar lnxpy commented on June 19, 2024

@alexvoss Thank you, Alex. I totally understand that. I just updated the issue opener comment. Hopefully, it meets the needs. Let me know if any other information is required. <3

from mkdocs-material.

lnxpy avatar lnxpy commented on June 19, 2024

@squidfunk Thank you, Martin. I really appreciate your instant response. I've had line_spans defined in my configs, but this delivery is gonna carry the fix I'm pretty sure.

from mkdocs-material.

alexvoss avatar alexvoss commented on June 19, 2024

@squidfunk, I installed the latest commit and added the line_spans to the mkdocs.yml but still see the same thing. Is it possible that some change in the CSS is also needed? I see the code element has the md-code__content class but don't see CSS rules attaching to this. Hope I am not holding the wrong end of the stick there...

from mkdocs-material.

squidfunk avatar squidfunk commented on June 19, 2024

@alexvoss here's the modified reproduction that "works on my machine":
9.5.17-code-highlighting-issue.zip

Bildschirm­foto 2024-04-14 um 11 45 18

from mkdocs-material.

alexvoss avatar alexvoss commented on June 19, 2024

Now you are messing with me ;o) All good, it works fine now. Thanks for the fix. I tried to figure out what was going on yesterday but did not get anywhere. I could see the long ling was overflowing a box but could not find where the width was actually defined. At least that is what I thought I saw. May need to do a proper CSS course at some point...

from mkdocs-material.

squidfunk avatar squidfunk commented on June 19, 2024

The fix is actually a hack, so I don't think there's any CSS course telling you how to achieve this with the present structure, which is dictated by the Markdown extensions that generate the markup from Markdown.

from mkdocs-material.

alexvoss avatar alexvoss commented on June 19, 2024

I was trying to figure out why the long code line was overflowing some given width but could not even find out where that width came from. Might have just been too late in the evening. Perhaps a CSS course, then, and 10 years of experience in web design...

from mkdocs-material.

squidfunk avatar squidfunk commented on June 19, 2024

In 10 years, we're probably all completely automated by AI, so I'm not sure it'll pay off 😅

from mkdocs-material.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.