Ce document en Français

How to install and to configure Bluefish 2.0.1 to use HTML Tidy? How to use HTML Tidy with Bluefish 2.0.1?

First step: download and install Bluefish 2.0.1 and HTML Tidy

To download and install the latest version of Bluefish (which is version 2.0.1 at the time of writing this tutorial) on your PC, start KPackageKit (Applications starter Kickoff, then Applications, then System, then Software Management KPackageKit)

Select Software management, then type in bluefish in the text box "Search packets" to see if packets are available (installed or not). You should find one packet, identified as: Bluefish Editor - Web Development Editor

Second step: download and install HTML Tidy

Open Konsole: (Applications starter Kickoff, then Applications, then System, then Terminal Konsole)

In Konsole, type in

  tidy -version

If HTML Tidy is already installed on your PC, then the command should return the HTML Tidy version. The most recent version under Linux, at the time of writing this tutorial, is:
HTML Tidy for Linux/x86 released on 25 March 2009

If HTML Tidy is not installed on your system, then a message will offer you to download it and install it. Accept it!

The program « tidy » is not installed. You can install it with :
  sudo apt-get install tidy

If, after querying the HTML Tidy version, there is no message offering you to download and install the latest available version of HTML Tidy, then type into the Konsole:

  man tidy

Third step: configure Bluefish 2.0.1

Ideally, the configuration of Bluefish 2.0.1 in order to use HTML Tidy should be done in a way that an HTML document HTML being edited can be parsed, processed by HTML Tidy and get its code reformatted (pretty-printed). HTML Tidy should be configured to write-back on the input code; Bluefish 2.0.1 should be configured to allow HTML Tidy to reformat the markup code as it is being edited by Bluefish. The --write-back yes > '%f' command will do just that: --write-back yes is an option in HTML Tidy while >'%f' means to write over the original file.

Do Edit/Preferences/External Filters (left pane)
and then click inside the text command to edit it in this manner:

 |tidy --char-encoding utf8 --clean yes --doctype strict --drop-font-tags yes --drop-proprietary-attributes yes --enclose-block-text yes --enclose-text yes -indent --logical-emphasis yes --output-html yes --replace-color yes --show-warnings no --wrap 76 --write-back yes > '%f'|

Fourth step: configure HTML Tidy options

This is actually only at this point where HTML Tidy can be customized for your needs.

HTML Tidy hosts over 90 options and parsing, formating options for HTML documents. It is a very powerful utility program and is often misunderstood. To know about all of the formating and parsing options and what they can do, there is nothing better than to experiment.

Here is the command text including the options I use in HTML Tidy with Bluefish 2.0.1:

 |tidy --char-encoding utf8 --clean yes --doctype strict --drop-font-tags yes --drop-proprietary-attributes yes --enclose-block-text yes --enclose-text yes -indent --logical-emphasis yes --output-html yes --replace-color yes --show-warnings no --wrap 76 --write-back yes > '%f'|

If these options do not meet your needs, then feel free to modify them, add others or remove some. Make sure you copy the options correctly: carefully copy each blank white spaces and dash (hyphen) characters and the number of dashes.

You can examine every option and their description on the official HTML Tidy website.

Official HTML Tidy website
Complete reference of options in HTML Tidy

Valid HTML 4.01! Valid CSS! HTML Tidy