WordPress.org

Ready to get started?Download WordPress

Forums

SyntaxHighlighter Evolved
Set "height" (4 posts)

  1. American2020
    Member
    Posted 1 year ago #

    How can I set the height for the code box?

    My code is long, and I only want to show, lets say 10 lines, and then have a scroll-bar on right.

    Is it possible?

    Thanks.

    http://wordpress.org/extend/plugins/syntaxhighlighter/

  2. Alex Mills (Viper007Bond)
    Moderator
    Plugin Author

    Posted 1 year ago #

    Maybe.

    The highlighter package that my plugin uses doesn't support that but it might be possible to wrap it in a <div> of fixed height and give that <div> a scrollbar. You should be able to do this yourself I think:

    <div style="height:200px;overflow:auto;">
    [php]<?php echo 'hello world!'; ?>[/php]
    </div>

    If that works, I should probably add it as an option to my plugin.

  3. American2020
    Member
    Posted 1 year ago #

    Well, on the file shCore.css on the folder of the version 3 I modified the nect lines this way and it's doing his job.

    .syntaxhighlighter {
      height: 400px !important;
      width: 100% !important;
      margin: 1em 0 1em 0 !important;
      position: relative !important;
      overflow: auto !important;
      overflow-y: auto !important;
      font-size: 1em !important;
    }

    Note the height added and also the change on the overflow-y

  4. American2020
    Member
    Posted 1 year ago #

    Well, I didn't tried the div but by adding a height to that class and the overflow-y to auto, worked ok. I also think I can just remove the overflow-y and leave only overflow auto.

    Thanks for the answer. And yes it will be a great option for this plugin to be able to set the height, either from the setup, or from the same code on each post, in case someone needs different heights.

    [code lang="something" height="xxx px"]

    That would be awesome.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.