• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to format code within web pages

by admin

When displaying code within web pages it can be hard to read if it hasn’t been separated from the other text and images on the page. To get around this problem you can use google code-prettify JavaScript.

This allows code to be displayed like this:

google code-prettify

To implement this within your HTML you need to add the following lines of HTML:

At the start of your page:

<script src="https://cdn.example.com/google/code-prettify/master/loader/run_prettify.js"></script><script>

Then whenever you want to display code:

<pre class="prettyprint">
#!/bin/sh
echo "Hello, World!"
</pre>

Filed Under: Linux

Some more articles you might also be interested in …

  1. logwatch : command not found
  2. berks Command Examples (Chef cookbook dependency manager)
  3. rdesktop: command not found
  4. cpufreq-info: command not found
  5. usermod Command Examples in Linux
  6. halt: command not found
  7. func: Azure Functions Core Tools: Develop and test Azure Functions locally
  8. Understanding the Network interface configuration file /etc/sysconfig/network-scripts/ifcfg-eth#
  9. showmount Command Examples in Linux
  10. f3fix: Edit the partition table of a fake flash drive

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright