[pmwiki-users] Display text (actually C++ sample code) in a predifined-size with scrollers

Peter Bowers pbowers at pobox.com
Mon Apr 18 06:21:26 CDT 2011


On Mon, Apr 18, 2011 at 11:30 AM, Olivier Planchon
<olivier.planchon at gmail.com> wrote:
> I want to display C++ code in my pmWiki pages.
> I want to limit the size allowed to display the code, like in the (:input
> textarea name [=value=] rows=n cols=n:) form, where [=value=] will be tens
> or hundreds lines of C++ code.

I got this from the release notes sections of some of HansB's recipes
-- I think it'll do what you want:

(:div style="height:12em; padding:.4em; border:1px solid #dddddd;
background-color: #f8f8f8; overflow: auto;":)
[@
Code goes here.  Adjust the height and etc. in the style configuration above.
@]
(:divend:)

See http://www.qdk.org/pmwiki/index.php?n=Test.Scroll to see it in
action with some random PHP code.

You don't have to use [@...@] if you have a preferred way to display
it (see below) -- this is just a quick way to make sure nothing in the
code is interpreted as markup for your page.

You might also be interested in these resources for displaying code:

* http://www.pmwiki.org/wiki/Cookbook/Syntaxlove
* http://www.pmwiki.org/wiki/Cookbook/SourceBlock

-Peter



More information about the pmwiki-users mailing list