Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Pretify the site with CSS?

by tobyink (Canon)
on Apr 23, 2014 at 19:13 UTC ( [id://1083420]=note: print w/replies, xml ) Need Help??


in reply to Pretify the site with CSS?

Not strictly CSS, but if you enable the Free Nodelet under Nodelet Settings, and paste the following into your Free Nodelet Settings, then you'll get syntax highlighting for all code samples posted on the site:

<link rel="stylesheet" href="http://buzzword.org.uk/2012/codemirror-2. +36/lib/codemirror.css" type="text/css" media="all" /> <script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/ja +vascript"></script> <script src="http://buzzword.org.uk/2012/codemirror-2.36/lib/codemirro +r.js" type="text/javascript"></script> <script src="http://buzzword.org.uk/2012/codemirror-2.36/mode/perl/per +l.js" type="text/javascript"></script> <script src="http://buzzword.org.uk/2012/codemirror-2.36/mode/xml/xml. +js" type="text/javascript"></script> <script src="http://buzzword.org.uk/2012/codemirror-2.36/mode/css/css. +js" type="text/javascript"></script> <script src="http://buzzword.org.uk/2012/codemirror-2.36/mode/javascri +pt/javascript.js" type="text/javascript"></script> <script src="http://buzzword.org.uk/2012/codemirror-2.36/mode/htmlmixe +d/htmlmixed.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $farabi = $('<form action="http://localhost:3000/" method="post" s +tyle="display:none"><textarea name="source"></form>') $('body').append($farabi); $('p.code').each(function (i, c) { var $code = $(c).find('tt.codetext').text().replace(/\u00a0/g, +' ').replace(/\s+$/,''); var $dl = $(c).find('span.embed-code-dl'); var $pre = $( '<textarea class="CodeMirror">' + $('<div/>').text($code).html() + '</textarea>' ); var $footer = $('<div style="text-align:right"><small></small> +</div>'); var $editlink = $('<a href="#">farabi</a>'); $editlink.click(function () { $farabi.find('textarea').val($code); $farabi.submit(); return false; }); $footer.find('small').append("&#x5B;"); $footer.find('small').append($editlink); $footer.find('small').append("&#x5D; "); if ($dl.html()) $footer.find('small').append($dl.html()); $(c).after($footer); $(c).replaceWith($pre); CodeMirror.fromTextArea($pre.get(0), { lineNumbers: true, readOnly: true, matchBrackets: true, lineWrapping: true }); }); }); </script>
use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name

Replies are listed 'Best First'.
Re^2: Pretify the site with CSS?
by frozenwithjoy (Priest) on Apr 24, 2014 at 04:08 UTC

    EDIT: Oops. This was supposed to be in response to tobyink

    EDIT2: Arunbear moved my post to the intended spot. Thanks!

    Figured I'd post the thread where you first unleashed this, since there are some other helpful hints! - CSS Show and Tell: Colored Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1083420]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-20 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found