/build/static/layout/Breadcrumb_cap_w.png

ITNinja formatting tricks

Starting this as a living document, if you have tips, let me know and I'll be happy to insert them. 

Today's lesson is about the CODE style tag.
Here is a line of code

If you start your post in Normal style and then convert a block of text to Code style will strip out any empty, blank lines. So this:

Here are a couple of lines of code


here is the second line


Becomes this:
Here is a couple of lines of code
see here is the second line


However, if you have a space on the empty line, the blank formatting is kept:

Here is the first line of code
 
Here is the second line


If you start a code block, and then paste in the code, the blank lines are retained as well, but don't try and re-edit it.

#!/bin/bash
if [ -f "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Enabled.plist" ] ; then VERSION=$( defaults read "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Enabled.plist" CFBundleVersion )
else
   VERSION="Not installed."
fi
echo "$VERSION"

Adding new lines will break up the code blocks.

#!/bin/bash
if [ -f "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Enabled.plist" ] ; then VERSION=$( defaults read "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Enabled.plist" CFBundleVersion )
else
   VERSION="Not installed."
fi
echo "$VERSION"

To avoid breaking the code into separate blocks, select the whole block, change it back to the Normal Style, then edit it. When you have it edited, select the whole block and convert it back to Code.


Notice also that you can have several nested layers of code blocks:

Outer code block
Inner code block
Inner Inner code
Outer code

Comments

  • Nice examples. Just for those that wonder about the code behind the page. Click the questionmark. The project is called Summernote v:0.5.2 - dedenker 9 years ago
This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ