Giter Site home page Giter Site logo

Comments (5)

korny avatar korny commented on July 18, 2024

Actually, I thought a single line number of "1" would be obsolete, so I made a special case for that.

Is the behavior problematic for you, or just unexpeced?

How about an option for this, like :line_numbers_hide_single with a default setting of true?

from coderay.

nathany avatar nathany commented on July 18, 2024

How about an option to hide line numbers if there are less than x lines? (default 0, don't hide them). This would be more flexible. Reference:

Well, for line numbering my blog is a real use case :) In my blog most of the code blocks are about 10/15 lines, so line numbering is unnecessary, but in the post Extending RedCloth with CodeRay, there's a code snippet of 60 lines, and line numbering is useful only in that case. (Issue #65) - @nicolaracco

I think hiding line numbers should be off by default, but if we do that, this should probably be for 1.1? (a "breaking" change)

from coderay.

korny avatar korny commented on July 18, 2024

How about an option to hide line numbers if there are less than x lines?

The case seems to odd to me to make it an option. It's really easy to do yourself, and more readable:

CodeRay.highlight code, :ruby, :line_numbers => code.lines.count > 15 && :table

from coderay.

nathany avatar nathany commented on July 18, 2024

Nice. But then why not:

CodeRay.highlight code, :ruby, :line_numbers => code.lines.count > 1 && :table

Instead of having a special case built-in for hiding line numbers when there is only 1 line?

from coderay.

korny avatar korny commented on July 18, 2024

Good point. We will do that, but in 1.1. Also fixes OP's bug :-)

from coderay.

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.