WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WP-Syntax] Is there a way to limit the size or total number of lines shown? (2 posts)

  1. ajua
    Member
    Posted 4 years ago #

    I'm trying to use this to post Windows registry editor code but it seems that it doesn't have the option to limit or define a total number of lines shown and add a vertical scroll bar.

    I ask this because posting hundreds of lines worth of code make it difficult for the user to see all the post until scrolling way down the code to read the rest, which follow after the code.

  2. dougvdotcom
    Member
    Posted 4 years ago #

    Each code block is wrapped on output in a div with the class wp_syntax. Therefore, you could edit your template appropriately and simply specify a max-height and overflow:

    div.wp_syntax {
    max-height: 300px!important;
    overflow: auto;
    }

    You can get this pretty close if you set a specific line height within wp_syntax. For example, if you want to ensure that, say, 20 lines of code are shown in the block, you can do this:

    div.wp_syntax {
    max-height: 300px!important;
    overflow: auto;
    line-height: 15px;
    }

    Since 300 / 15 = 20, the box should show about 20 lines of code.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags