BHL mode : Plain text - HTML - LaTeX - ...

BHL mode : Plain text - HTML - LaTeX - ...

This is the manual of bhl version 1.8rc1.

bhl is an Emacs mode that enables you to convert a plain text file into an HTML, SGML, LaTeX, Texinfo, Wiki and TXT file. Since you can run bhl offline, it's also a standalone format: writing a bhl file makes it ready for generic conversions.

bhl” is an acronym for: Brute (i.e. “plain”) to Html and LaTeX.

I have been asked if there was an easy way to pronounce “bhl”. Yes, there is. Bhl- is the indo-european root for “blow” (and derivative but less poetic verbs like “blather”). So, just say “blow”.

1 Overview

1.1 What is BHL?

bhl is a text formatting and publishing tool. It is an Emacs mode that provides two kinds of tools: tools for editing a plain text file as an implicitly structured document, and tools for converting this document into other formats: HTML, SGML, LaTeX, Texinfo and TXT.

In order to be readable by bhl, a plain text file must fit some syntactic conventions. This conventions are neither completely universal nor specially odd. They are chosen among the most useful and the most convenient text formatting conventions. The purpose of this mode is to use the most invisible and convenient syntax. “Invisible syntax” means that the source file must be as readable as possible – like any plain text file must be. “Convenient syntax” means that it must fit the users' habits.

For example, *word* appears in bold; _word_ appears in emphasis; lists and URLs follow StructuredText or Wiki conventions; the numbering of sections respects logic and intuition. (See The syntax.)

In short: there is nothing you have to learn to write your documents with the bhl mode (just try, it's true).

bhl is not WYSIWYG since you are only editing text. bhl is not WYSIWYM (like LyX), since what you mean is editing text. So, what is bhl? It is WYSIWYS(IWYS): What You See Is What You See (Is What You See). Editing text is editing text.

1.2 Why should I use BHL?

Happy sectioning
You can easily update the numbering of sections and (sub)subsections. You can easily choose/convert the style of sectioning. You can insert the table of content where you want. See Sections.
Happy links
bhl likes links: you can quickly jump to the next link, follow it (either an URL or a WikiName), browse through the complete list of your document's links and insert this list into your document. See The list of links.
Happy specifications
You can specify some conversion properties inside a document, so that bhl converts this document properly. See Specifications.
Happy footnotes
Footnotes won't stay aside. You can convert each of them, even if you are not using the classical numeric style.

2 Installing BHL

You have just downloaded bhl.tar.gz on http://www.nongnu.org/bhl. Untar the archive like this:

     ~$ tar zxvf bhl.tar.gz

Go to the bhl-*/ directory and set up the Makefile. Once this is done, just compile and install like this:

     ~$ make
     ~$ make install

If you want to install bhl in your /usr/local/ or /usr/share/ paths, you need to have superuser (i.e. root) permissions. But don't worry: at the end of the install procedure, a message tells you if something has gone wrong.

If you want to generate and install the bhl.info file:

     ~$ make info
     ~$ make install-info

If you want the printed manual (PDF):

     ~$ make pdf

If you want the HTML manual:

     ~$ make html

If you want to clean up the directory:

     ~$ make clean

You can add these lines to your ~/.emacs.el:

     (autoload 'bhl-mode "bhl" "BHL Mode" t)
     (add-to-list 'auto-mode-alist '("\\.bhl$" . bhl-mode))

The last line enables you to associate a new extension (i.e. .bhl) with the bhl editing mode, so that bhl will automatically be loaded when you open a .bhl ending file.

3 The syntax

Ordinarily, a plain text file has no visible or invisible syntax. To be bhl-readable, a file has to respect some conventions.

3.1 Title and paragraphs

The title is mandatory. bhl tries to read it in the very first lines of the buffer. The title is on a line that does not include any newline or tab character.

The subtitle is not mandatory. It is currently included in the HTML, TXT and Texinfo output. You can include it as a specification, like this:

     #!subtitle!My subtile subtitle

For details on how to format and insert specifications, See Specifications.

The paragraphs always begin at the beginning of the line. Don't indent paragraphs: restrict indentation to lists.

3.2 Sections

bhl handles three levels of section: sections, subsections and subsubsections.

bhl handles five different sectioning styles: num, alpha, aster, equal-sign and user-defined. The default style is set to numerical.

Here is a table with examples of each sectioning style:

num
1.<SPC>A section
1.1.<SPC>A subsection
1.1.1.<SPC>A subsubsection

alpha
A.<SPC>A section
A.A.<SPC>A subsection
A.A.A.<SPC>A subsubsection

aster
*<SPC>A section
**<SPC>A subsection
***<SPC>A subsubsection

equal-sign
=<SPC>A section
==<SPC>A subsection
===<SPC>A subsubsection

You can choose the default style of sectioning by modifying bhl-sectioning-default-style. This is the default sectioning style for any newly created bhl file.

When you find an already existant bhl file, bhl tries to guess its sectioning style, if you've set bhl-autoguess-style-flag to t – which is its default value. At any time, you can ask bhl to guess the style with bhl-guess-style, which is bound to <C-c M-s> (and also available from the menu, as usual).

For example, suppose you are using the alphabetical style in foo.bhl and your bhl-sectioning-default-style is set to num, then bhl will automatically turn the current style to alpha. If bhl is not able to recognize any style, it sets the sectioning style to the value of bhl-sectioning-default-style.

Don't mix sectioning styles! If bhl finds a numerical section, it will consider that all the (sub)sections are numerical, which is actually rather stupid, but I've no time for this at the moment.

You can switch from one style to another style from the menu or with bhl-sectioning-switch-style. This command reads a style from the minibuffer and converts the (sub)sections' prefix into the chosen style.

If you choose to use your own style, you have to manually customize bhl-my-sectioning-regexp-list. See Global options. This variable includes a list of the three regular expressions that match respectively the sections, subsections and subsubsections. Please note that bhl-udpate-toc won't work anymore if you set bhl-sectioning-default-style to my.

You can update the sections' prefix (numbers or letters) with <C-c M-t>, which is the default key binding for bhl-update-toc.

3.3 Fonts and environments

This section describes the use of font beautifiers, environments and horizontal rules.

3.3.1 Font beautifiers

Font beautifiers allow you to emphasize, underline, boldify and truetypify some words.

In the SGML and Texinfo outputs, underline means put in italic, just like emphasis. In the HTML and LaTeX output, underline means underline truly.

If you want to put your text in bold-italic, use _*this order*_ rather than *_this order_*. Note that bold-italic is not available in the Texinfo output.

If you want to insert an underscore or an asterisk that has no syntactic meaning, put an escape character before: \* and \_. The same is possible with the comment character #. See Comments.

You can choose a font beautifier for a specific region with the bhl-change-font- commands. See Changing font.


Here are the tags to be used in your bhl file if you want to change the fonts:
*a word*
put a word in bold font.
_a word_
put a word in emphasis font.
_*a word*_
put a word in bold and italic font.
__a word__
underline a word.
==a word==
put a word in truetype font.

3.3.2 Comments

The character for introducing new comments is #.

You can insert comments wherever you want, but comments always end at the end of the current line. There is no “ending-comment” character.

If you want to insert a # which should not introduce a new comment, use the escape sequence \#.

You can comment the current region with bhl-comment-region <C-c ;> and uncommment it by adding a symbolic prefix to bhl-comment-region <C-u C-c ;>.

You can make comments invisible with bhl-hide-comment and make them visible again with C-u bhl-hide-comment.

3.3.3 Environments

bhl handles three environments: quote, verbatim and minipage. The first one quotes some part of text. The second one may be useful for inserting code into a documentation. The third one creates a minipage inside the main page, with or without borders.

3.3.3.1 Quote environment

To quote some part, just add one single tab in the beginning of each line. Here is an example:

             Put some words here.
             Put some words here.
             Put some words here.
             Put some words here.
3.3.3.2 Verbatim environment

Here is the syntax of the verbatim environment:

     --
     Put some words here.
     --

Attention: two dashes are the default delimiters for the verbatim environment, while four dashes are markers for horizontal rules.

Remember that the highlighting of dashes indicates the syntaxic role they play when bhl-special-face differs from bhl-hr-face (which is the default case). See Horizontal rules.

The bhl-verbatim-ignore variable contains a list of syntactic elements that have no meaning inside a verbatim environment. This means that those syntactic elements won't be converted, even if they are fontified. See Global options.

3.3.3.3 Minipage environment

Here an example of how to insert a minipage:

     %%%[12cm]
     This minipage (12cm) will be centered without border.
     %%%
     
     <%%[10cm]
     This minipage (10cm) will be put on the left without border.
     %%%
     
     >-%
     This minipage will be put on the right with borders.
     %%%

The basic indicator for the beginning and the end of a minipage environment is %%% at the beginning of a line. This indicates a centered minipage, without border and of the same width as the main page.

By replacing the first % with a < or a >, you put the minipage respectively on the left or on the right. For example, <%%%% indicates a left aligned minipage which has the same width as the main page.

By replacing the second % with a dash (-), you put solid borders on the minipage. For example, <-%%%%% indicates the beginning of a minipage that has the same width as the main page, put on the left with solid borders.

The length can be put into square brackets like this: %%%[8cm]. It is optional. Avoid using relative lengths such as “40%”: the % character is syntax-sensible in the LaTeX environment. Use only absolute lengths and common units.

Minipages are properly converted only for the HTML, LaTeX and Texinfo outputs. For the Texinfo output, you can choose what a centered minipage looks like with bhl-texi-centered-minipage-tag. For the SGML output, you can choose what a minipage looks like with bhl-sgml-minipage-tag. bhl2txt does not convert minipages, it simply strips the %%% at the beginning of the line.

You can insert a minipage with bhl-insert-minipage. See Inserting.

3.3.4 Horizontal rules

A horizontal rule is represented by at less four dashes (---- - Small), equal signs (==== - Large) or slashes (//// - X-Large) at the beginning of a line.

The first character can be replaced by an indicator of alignment.

Attention: horizontal rules are not converted in the SGML and Texinfo formats.

     ----[12cm]
     <---[12cm]
     >---[12cm]

The first line will be centered. The second line will be put on the left. The third line will be put on the right. The width of these lines is 12cm. The length is optional: you can simply insert ----, ==== or ////.

You can insert a horizontal rule with bhl-insert-hr. See Inserting.

3.4 Escaping characters

You can escape four characters: asterisk (*), underscore (_), sharp # and backslash \. When escaped, these characters have no syntactic effect anymore. Escaping backslashes only makes sense for the bhl2latex conversion.

When converting into LaTeX, bhl escapes some characters by itself. These characters are: $ & % { }. Attention: the bhl2latex conversion does NOT automatically convert backslashes. You've to insert something like $\backslash$ by yourself or escape them like \\. When converting into Texinfo, bhl escapes @ { }.

If you don't want that bhl escapes those characters, just escape them by yourself in the bhl file.

3.5 Handling links

3.5.1 What is a link?

There are two kinds of links: URLs and WikiNames. An URL is... you know what it is. A WikiName is a mixed-case word like “MyWikiName”. When the cursor is on a link, you can hit <RET> or <mouse-2> to follow it. Following an URL calls bhl-browse-url-function. Following a WikiName finds a new file whose name is the concatenation of the WikiName and the .bhl extension.

You can downcase this resulting name by setting bhl-downcase-wikifiles-names-flag to non-nil. You can also change the default extension of WikiFiles names by setting bhl-default-wikifiles-extension. The list of mixed-case strings that shouldn't be considered as WikiNames is stored in bhl-non-wiki-names-list.

You can see the list of links of your document with bhl-show-lol, which is bound to <C-c C-/>. You can insert the list of links of your document with bhl-insert-lol, which is bound to <C-c C-c l>. See The list of links.

You can browse URLs and WikiNames with bhl-goto-next-url-or-wiki <C-TAB>. (See Browsing the BHL file.)

3.5.2 Converting Links

URLs are converted by the bhl-convert-url function and WikiNames are converted by the bhl-convert-wiki-names function. You can write your URL as it is (http://site.org), or put it into square brackets to define a label: [[http://site.org][my site]].

You can insert an URL with bhl-insert-url, <C-c C-c h>: See Commands and key bindings.

Here is a list of some URLs and their conversions into the HTML format:

http://site.org
<a href=“http://site.org”>http://site.org</a>
url:mypage.html
<a href=“mypage.html”>mypage.html</a>
[[http://site.org][SITE]]
<a href=“http://site.org”>SITE</a>
mailto:bb@site.fr
<a href=“mailto:bb@site.org>bb@site.org</a>
[[mailto:bb@site.fr][BB]]
<a href=“mailto:bb@site.org>BB</a>

Here is a list of some URLs and their conversions into the LaTeX format:

http://site.org
\url{http://site.org}
url:mypage.html
\url{mypage.html}
[[http://site.org][SITE]
SITE (\url{http://site.org})
mailto:bb@site.org
\url{bb@site.org}
[[mailto:bb@site.org][BB]]
BB (\url{bb@site.org})

Here is a list of some URLs and their conversions into the Texinfo format:

http://site.org
@uref{http://site.org}
url:mypage.html
@uref{mypage.html}
[[http://site.org][SITE]
@uref{http://site.org,SITE}
mailto:bb@site.org
@uref{bb@site.org}
[[mailto:bb@site.org][BB]]
@uref{bb@site.org,BB}

Here is a list of some URLs and their conversions into the SGML format:

http://site.org
<HTMLURL URL=“http://site.org” NAME=“http://site.org”>
url:mypage.html
<HTMLURL URL=“mypage.html” NAME=“mypage.html”>
[[http://site.org][SITE]
<HTMLURL URL=“http://site.org” NAME=“SITE”>
mailto:bb@site.org
<HTMLURL URL=“mailto:bb@site.org” NAME=“mailto:bb@site.org”>
[[mailto:bb@site.org][BB]]
<HTMLURL URL=“mailto:bb@site.org” NAME=“BB”>

Here is a list of some URLs and their conversions into the TXT format:

http://site.org
http://site.org
url:mypage.html
mypage.html
[[http://site.org][SITE]
http://site.org (SITE)
mailto:bb@fardeau.fr
bb@fardeau.fr
[[mailto:bb@fardeau.fr][BB]]
bb@fardeau.fr (BB)

In these examples, you can replace `http://' by `ftp://' or `file:///'. When using [[...][...]], a prefix like `http://' is not mandatory.

3.6 Handling lists

bhl handles three kinds of lists: non-ordered lists, ordered lists and descriptive (or definition) lists.

A non-ordered list item is defined by: some <TAB> at the beginning of the line, a list separator among <- * o>, a whitespace.

An ordered list item is defined by: some <TAB> at the beginning of the line, a number, a dot, a whitespace.

A definition list item is defined by: some <TAB> at the beginning of the line, a term, a whitespace, two dashes, a whitespace.

<TAB> inserts an indent-relative TAB, while <M-TAB> inserts a rigid TAB mesuring exactly three columns. Make sure that there is a whitespace after a *: no whitespace means that the next characters may use bold font.

bhl handles also nested lists, but no definition list can be nested. To add a nested item, just add a TAB character relatively to the previous item. In each list, the first item indicates the kind: ordered, non-ordered or definition list.

Here is a table of lists separators:

<TAB(S)>[*,-,o]<SPC>
item of a non-ordered list
<TAB(S)>[0-9].<SPC>
item of an ordered list (enumerate)
<TAB(S)>A term<SPC>--<SPC>
item of a definition list

Take a look at the examples on http://www.nongnu.org/bhl for further details.

3.7 Handling tables

Here is an example of a table:

      | @Name@  | @First name@  | @Age@  |
      | Jean    | Luc-Henri     | 123    |
      | Paul    | Matthieu      | 2      |

The character | has three different functions: it begins a new row, it seperates two cells, it ends a row. Whitespaces and tab characters are NOT allowed between the beginning of a new line and the first |.

Optional @ around the cell content indicates that this cell is a header. Typically, you put headers on the very first row of the table. In the HTML output, a header cell is put into <TH></TH> tags. In other LaTeX and SGML, the header line is separated from the rest of the table by an horizontal rule.

More details about the table options: See Converting tables.

3.8 Handling images

Here is an example of how to insert an image:

     [[image.jpg]]

You can search for a particular file and insert it as an image with <C-c C-c i>, wich is the default key binding for bhl-insert-image.

Only bhl2html handles images. Other conversion functions like bhl2sgml, bhl2texinfo or bhl2latex put images into comment strings. bhl2txt erases images.

4 Properties of conversion

You may want to convert your bhl document without customizing anything. This is OK. But you surely want to control some properties of the different conversion functions. For example, you may decide that the HTML conversion includes the table of contents, whereas the LaTeX conversion doesn't. You may want to calculate the \date{...} command of the LaTeX output relatively to the current time. You may want to set up a different CSS style for a particular HTML output. Etc.

This section tells you how to do this.

4.1 Overview of properties

The two important variables for the choice of conversions properties are bhl-xxx-conversions-list and bhl2xxx-properties-list, where xxx is the name of the conversion. See Global options.

bhl-xxx-conversions-list includes the detailed list of conversions for each format. Normally you should not change this variable too often.

bhl2xxx-properties-list allows you to set global options for the conversion. These global options deal with the checking of dubious tags, the insertion of the sections' prefix, the tables' captions, the i18n conventions, the insertion of the table of contents and the centering of sections/title (for the bhl2txt conversion.) You can change this variable by:

This order is important: the options set inside a specification line will override the options set from the menu, which override those set in the default customization.

These global options are set to their default value (i.e. their customized value) each time you run the bhl-mode command. They are also set to their default value after each conversion, except if you remove the bhl-initialize-properties function from the bhl-after-conversion-hook list.

4.2 Specifications

bhl allows you to add some specification lines inside a document, so that bhl handles this document adequately. Specifications concern mainly two kind of properties: the properties of the document's header and the conversion properties. Here are some examples of specification lines:

     #!html!prefix:check:caption:toc
     #!latex!noprefix:nocheck:nocaption:notoc
     #!date!It's %H:%M.

In this example, the command bhl2html will insert the sections' prefix, check for dubious tags, ask for a caption for each table and insert the table of contents (also known as toc). The command bhl2latex WON'T insert the sections' prefix, check for dubious tags, ask for a caption for each table and insert the toc. The date will be set to the current time (hours:minutes). Quite simple, isn't it?

A specification line is always a comment at the beginning of the line. It splits into two parts: a prefix, which is enclosed into two exclamation marks, and the labels, which are separated by a column. Each label can be turned off by adding no-: notoc is the exact opposite of toc.

Here is a complete list of available specification prefix and their relevant labels.

#!author!
The name of the author for the current document.
#!title!
The title of the document. This specification overrides any other title (the first line of the buffer or any #!xxx-title! specification).
#!xxx-title!
The title of the document for the xxx conversion. xxx may be html, sgml, texi or latex. This specification is overriden by the #!title! specification, and overrides the first line of the buffer.
#!subtitle!
The subtitle of the document. The subtitle conversion is supported only for the HTML, Texinfo and TXT output.
#!lang!
The language of the document. This override the value of bhl-i18n-conventions. In the Texinfo output, it sets the value of @documentlanguage.
#!encoding!
The encoding of the document. This information is relevant for the Texinfo and HTML conversion. In the Texinfo output, it sets the value of @documentencoding. In the HTML output, it overrides the value of bhl-html-content-type.
#!date!
The date of the current document. Since the column has no special meaning here, you can use the Emacs time-formatting conventions. For example, #!date!%H:%M will set date to the current time (hours:minutes). see Time Conversion.
#!html!
The prefix concerning bhl2html specifications. Here is a complete list of available labels:
prefix
Insert the prefix of (sub)sections.
check
Check for dubious HTML tags/comments before converting.
caption
Ask for a caption when converting a table.
i18n
Use i18n conventions.
toc
Insert the table of content in the HTML output.

#!html-style!
The CSS file to refer to as the style for the HTML output.
#!latex!
The prefix concerning bhl2latex specifications. Here is a complete list of available labels:
prefix
Insert the prefix of (sub)sections.
check
Check for dubious LaTeX commands/comments before converting.
caption
Ask for a caption when converting a table.
i18n
Use i18n conventions.
toc
Insert the table of content in the LaTeX output.

!#latex-class!
The class of the LaTeX output.
#!latex-options!
The options of the chosen class. You can insert as many options as you want, provided that you separate them with a column.
#!latex-packages!
Some LaTeX packages and their options. For example :
          
          #!latex-packages!fontenc[T1]:[latin1]inputenc:babel[french]
          
          \usepackage[T1]{fontenc}
          \usepackage[latin1]{inputenc}
          \usepackage[french]{babel}
          
     

The location of the square brackets doesn't matter.

#!texi!
The prefix concerning bhl2texinfo specifications. Here is a complete list of available labels:
check
Check for dubious Texinfo commands/comments before converting.
i18n
Use i18n conventions.
toc
Insert the table of content in the Texinfo output.

#!texi-style!
The style of the frontpage in the Texinfo output. May be either classical or centered.
#!sgml!
The prefix of bhl2sgml specifications. Here is a complete list of available labels:
check
Check for dubious SGML tags/comments before converting.
caption
Ask for a caption when converting a table.
i18n
Use i18n conventions.

#!txt!
The prefix of bhl2txt specifications. Here is a complete list of available labels:
center
Center the title and (sub)sections' titles.
toc
Insert the table of content in the TXT output.
tas
tabs are spaces: convert tabs to whitespaces in the TXT output.

5 Browsing your document

The bhl mode comes with two commands that allows you to browse your document: bhl-show-toc and bhl-show-lol. The latter is not a joke: it allows you to browse the list of links. The former allows you to browse the table of contents. These two commands create a new buffer turned into either bhl-toc-mode or bhl-lol-mode.

5.1 The table of contents

The bhl mode enables you to update the numbering of sections of your bhl file, to insert the table of contents into your bhl file, to browse the table of contents in a new buffer.

Two variables are required to handle the table of contents: bhl-toc-location and bhl-default-toc-depth. The first one defines the location of the inserted toc. You can change its value via the menu or via customize. The second one defines the default toc depth.

You can insert the toc with bhl-insert-toc <C-c C-c t>. A numeric argument defines the depth of this inserted toc. You can also insert the toc from the *toc* buffer with <i>. From this buffer, the toc depth is set to the depth of the currently displayed toc.

When it converts the buffer, bhl first checks if there is a table of contents. If there is one, bhl inserts it in the output according to the current toc location of the buffer.

5.1.1 Browse the table of contents

You can get a new buffer, named *toc*, with a browsable table of contents. You can browse the toc via the menu or with the key binding <C-c C-t>. An optional numeric argument indicates the toc depth.

<?>
Display a quick help for the bhl-toc-mode.
<q>
Quit the *toc* buffer.
<n>
Go to the next item.
<p>
Go to the previous item.
<>>
Go to the last item.
<<>
Go to the first item.
<i>
Insert the table of contents in your bhl file.
<1>
Set the toc depth to 1.
<2>
Set the toc depth to 2.
<3>
Set the toc depth to 3.

5.1.2 Insert the table of contents

You can insert the table of contents of your bhl file into itself with <C-c C-c t>. If a toc has already been inserted, this command only updates the table of contents, leaving it to its current location. If a toc has not been inserted yet, this command inserts a new one according to the value of bhl-toc-location. An optional numeric argument indicates the toc depth.

5.2 The list of links

You can see the list of links with bhl-show-lol. The default key for this command is <C-c C-/>. A new buffer is created, named *lol* and turned into the bhl-lol-mode.

While moving inside this buffer, your document's buffer is updated so that its point is set to the link you're currently pointing on. You can also visit the link you're pointing on with <RET> or <mouse-2>.

Here is a list of the available commands inside the bhl-lol-mode:

<?>
Display a quick help for the bhl-lol-mode.
<q>
Quit the *lol* buffer.
<n>
Go to the next item/link.
<p>
Go to the previous item/link.
<>>
Go to the last item/link.
<<>
Go to the first item/link.
<i>
Insert the list of links into your document.

6 Commands and key bindings

This section describes the main commands of the bhl mode.

6.1 Conversion commands

This conversion commands end with two hooks: a hook relative to each conversion format (bhl-xxx-after-conversion-hook) and a global hook (bhl-after-conversion-hook). You can also reach these commands from the popup menu <C-down-mouse-3>: press <control> and the right button of the mouse.

— Function: bhl2html

Convert the current buffer into HTML and display the output in a new buffer. The default key binding is <C-c C-w>.

— Function: bhl2latex

Convert the current buffer into LaTeX and display the output in a new buffer. The default key binding is <C-c C-l>.

— Function: bhl2texinfo

Convert the current buffer into Texinfo and display the output in a new buffer. The default key binding is <C-c C-o>.

— Function: bhl2sgml

Convert the current buffer into SGML (Linuxdoc) and display the output in a new buffer. The default key binding is <C-c C-s>.

— Function: bhl2wiki

Convert the current buffer into (kind of) WIKI and display the output in a new buffer. Strip the remaining tags and syntaxic elements. The default key binding is <C-c C-k>.

— Function: bhl2txt

Convert the current buffer into TXT and display the output in a new buffer. Strip the remaining tags and syntaxic elements. The default key binding is <C-c C-d>.

6.2 Inserting

— Function: bhl-insert-url

Read an URL and his name from the minibuffer and insert it. The default key binding is <C-c C-c h>.

— Function: bhl-insert-image

Read the filename of an image from the minibuffer and insert it. The default key binding is <C-c C-c i>.

— Function: bhl-insert-minipage

Insert a minipage. The default key binding is <C-c C-c m>.

— Function: bhl-insert-verbatim

Insert a verbatim environment. The default key binding is <C-c C-c v>.

— Function: bhl-insert-hr

Insert a horizontal rule. Ask for its alignment and width in the minibuffer. The default key binding is <C-c C-c r>.

— Function: bhl-insert-toc [depth]

Insert the table of contents into the current buffer. The default key binding is <C-c C-c t>. This command is also available from the *toc* buffer in bhl-toc-mode with <i>.

The optional argument (depth) indicates the toc depth. Without any argument, the toc depth's value is bhl-default-toc-depth.

You can insert the table of contents in three different places: just after the title, just before the end, just at the point. The value of bhl-toc-location defines the toc location.

— Function: bhl-insert-lol

Insert the list of links into the current buffer. The default key binding is <C-c C-c l>. This command is also available from the *lol* buffer in bhl-lol-mode with <i>.

6.3 Browsing the BHL file

— Function: bhl-show-toc [depth]

Get a new buffer named *toc* with the table of contents. The default key binding is <C-c C-t>. The optional argument (depth) indicates the toc depth. Without any argument, the toc depth's value is bhl-default-toc-depth. This command is also available from the popup menu.

— Function: bhl-show-lol

Get a new buffer named *lol* with the list of links. A link may be an URL or a WikiName. The default key binding is <C-c C-/>. This command is also available from the popup menu.

— Function: bhl-goto-next-section

Go to the next section. The default key binding is <C-c C-n>. With <C-u>, go to the next section or (sub)subsection.

— Function: bhl-goto-previous-section

Go to the previous section. The default key binding is <C-c C-p>. With <C-u>, go to the previous section or (sub)subsection.

— Function: bhl-goto-next-url-or-wiki

Go to the next URL or WikiName. The default key binding is <C-TAB>.

6.4 Changing font

— Function: bhl-change-font-bold

Place the cursor between two *. If a region is selected, put the region between two *. This overrides previous fontification. The default key binding is <C-c C-f C-b>.

— Function: bhl-change-font-emphasis

Place the cursor between two _. If a region is selected, put the region between two _. This overrides previous fontification. The default key binding is <C-c C-f C-e>.

— Function: bhl-change-font-underline

Place the cursor between two __. If a region is selected, put the region between two __. This overrides previous fontification. The default key binding is <C-c C-f C-u>.

— Function: bhl-change-font-truetype

Place the cursor or a selected region between two ==. If a region is selected, put the region between two ==. This overrides previous fontification. The default key binding is <C-c C-f C-t>.

— Function: bhl-change-font-bolditalic

Place the cursor between _* and *_. If a region is selected, put the region between _* and *_. This overrides previous fontification. The default key binding is <C-c C-f C-_>.

— Function: bhl-change-font-normal

Strip any fontification of the selected region. No effect when no region is selected. The default key binding is <C-c C-f C-n>.

6.5 Miscellaneous

— Function: bhl-sectioning-switch-style

Read a sectioning style from the minibuffer and convert (sub)sections' prefix into this style. The available styles are num, alpha, aster and equal-sign.

— Function: bhl-comment-region

Comment the current region. With a symbolic argument, uncomment the current region. The default key binding is <C-c ;>.

— Function: bhl-hide-comment

Make the comments invisible. With a symbolic argument, make the comments visible again.

— Function: bhl-compose-mail

Convert the current buffer into TXT format with bhl2txt and use the output in a mail draft. The default key binding is <C-c C-x m>. This command is also available from the popup menu.

— Function: bhl-view-log

Display the log of the last conversion in a temporary buffer.

— Function: bhl-update-toc

Update the sections', subsections' and subsubsections' numbering. The default key binding is <C-c M-t>.

— Function: bhl-submit-but-report

Send a mail with a bug report. This is only available in GNU Emacs.

— Function: bhl-show-version

Display the version number of the bhl mode. The default key binding is <C-c C-v>.

— Function: bhl-texi-toggle-accents

Toggle accents in a Texinfo buffer. If you are using accents, it may be a good idea to add this function to bhl-after-texi-conversion-hook.

7 Options

You can change the value of each option via M-x customize-group RET bhl RET or via Customize BHL in the bhl menu.

7.1 Global options

— User Option: bhl-mode-hook

Hook run while in bhl mode. If you are under GNU Emacs, it could be useful to add footnote-mode, since bhl converts footnotes.

— User Option: bhl-after-conversion-hook

Hook run at the very end of a conversion. The default value is bhl-initialize-properties. If you remove this function, the conversion properties of the last converted buffer will be the default conversion properties for the next converted buffer – which may not be what tou really want.

— User Option: bhl-autoguess-style-flag

If non-nil, autoguess the sectioning style. When you find a file, BHL tries to guess its sectioning style and sets the value of `bhl-sectioning-default-style' to the value of the file's style.

The default value of bhl-autoguess-style-flag is nil.

— User Option: bhl-sectioning-default-style

Define the style for the titles of sections, subsections and subsubsections. The five available styles are: numerical (num), alphabetical (alpha), asterisks (aster), equal-signs (equal-signs) and your own style (my). See Sections.

If you want to use your own style, you have to define bhl-my-sectioning-regexp-list. In this case, bhl-update-toc is not available anymore.

— User Option: bhl-my-sectioning-regexp-list

A list of regular expressions that match the different levels of sectioning. They respectively match the prefix of a section's, subsection's and subsubsection's title. Since the titles of the sections are always put at the beginning of the line, you don't have to insert a ^ in these regular expressions.

The default value of bhl-my-sectioning-regexp-list is the value of bhl-my-sectioning-regexp-list, which corresponds to the numerical style (num)..

— User Option: bhl-verbatim-ignore

A list of syntactic elements that shouldn't be converted when found inside a verbatim environment. The default value of this variable is (tag comment list description table url wikiname images special-char tex-label footnote quote).

— User Option: bhl-ignored-regexps

A list of regexps. Each line matching a regexp within this list is automatically killed before any conversion.

— User Option: bhl-tags-overlap-flag

Non-nil means that you can use tags on multiple lines. Maybe useful to turn this option off is you want to use tags on multiple lines inside a verbatim environment.

— User Option: bhl-i18n-conventions

The car of this variable is a language specification among english, french and german. bhl will follows conventions according to the chosen language.

If the second element if t, bhl follows conventions concerning the punctuation, as defined in bhl-xx-punctuation (where xx is en, fr or de).

If the third element if t, bhl follows conventions concerning the quotation marks, as defined in bhl-xx-quotation-marks.

If the fourth element if t, bhl follows conventions concerning special characters, as defined in bhl-xx-special-chars.

— User Option: bhl-browse-url-function

A function for calling your favorite browser. The default value is browse-url.

7.2 BHL to HTML

— User Option: bhl-after-html-conversion-hook

Hook run after the HTML conversion.

— User Option: bhl2html-properties-list

The list of properties relevant for the bhl2html conversion. See Properties of conversion. Don't modifiy this variable manually. Use M-x customize instead.

— User Option: bhl-html-conversions-list

A list of conversions to perform with bhl2html. Each element of this list is boolean. Don't edit this option manually, use M-x customize instead.

— User Option: bhl-html-meta-alist

A list of META tags to be inserted in the header of HTML output. Each element is divided into two elements: the first one indicates the name of the META tag, the second one indicates the content of the META tag.

'((``author'' . ``you''))
<META name="author" content="you">

— User Option: bhl-html-link-alist

A list of LINK tags to be inserted in the header of HTML output. Each element is divided into two elements: the first one indicates the rel of the LINK tag, the second one indicates the href of the LINK tag.

'((``generator-home . ``http://www.nongnu.org/bhl))
<LINK rel="generator-home" href="http://www.nongnu.org/bhl">

— User Option: bhl-html-doctype

The document type description of the HTML output. The default value is: <!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">.

— User Option: bhl-html-content-type

The content type description of the HTML output. The default value is: <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1>".

— User Option: bhl-html-default-style

The style to be inserted into the header (<HEAD>...</HEAD>) of the HTML output.

— User Option: bhl-html-title-tags

A list defining the opening and closing tags of the HTML title.

— User Option: bhl-html-subtitle-tags

A list defining the opening and closing tags of the HTML subtitle.

— User Option: bhl-html-para-align

How bhl aligns each paragraph of the HTML output. The default value is none.

— User Option: bhl-html-img-align

Image alignment. The default value is center.

— User Option: bhl-html-list-item-is-para-flag

Non-nil means that list items are paragraphs into the HTML output.

— User Option: bhl-html-footer

A string that will be put at the end of the HTML output.

7.3 BHL to LaTeX

— User Option: bhl-after-latex-conversion-hook

Hook run after the LaTeX conversion.

— User Option: bhl2latex-properties-list

The list of properties relevant for the bhl2latex conversion. See Properties of conversion. Don't modifiy this variable manually. Use M-x customize instead.

— User Option: bhl-latex-conversions-list

A list of conversions to perform with bhl2latex. Each element of this list is boolean. Don't edit this option manually, use M-x customize instead.

— User Option: bhl-latex-packages-alist

A list of packages to be included in the LaTeX header. Each element is divided into two elements: the first one indicates the name of the packages, the second one indicates the options of the package.

'((``inputenc'' . ``latin1''))
\usepackage[latin1]{inputenc}.

— User Option: bhl-latex-default-class

The default class of document for the LaTeX output. The default value is article.

— User Option: bhl-latex-default-class-options

The default options passed to the \documentclass{...} command. The default value is 12pt.

— User Option: bhl-latex-extra-preambles

A list of lines to be included in the LaTeX header.

— User Option: bhl-latex-extra-body

A list of lines to be included before the first section.

— User Option: bhl-latex-default-class-options

The default options passed to the \documentclass{...} command. The default value is 12pt.

— User Option: bhl-latex-footer

A string that will be put at the end of the LaTeX output.

7.4 BHL to Texinfo

— User Option: bhl-texi-conversion-hook

Hook run after the Texinfo conversion. The default value is (texinfo-every-node-update bhl-texi-make-menu), so that the output file is ready for compilation. If you are using accents, you may add bhl-texi-toggle-accents.

— User Option: bhl2texi-properties-list

The list of properties relevant for the bhl2texinfo conversion. See Properties of conversion. Don't modifiy this variable manually. Use M-x customize instead.

— User Option: bhl-texi-conversions-list

A list of conversions to perform with bhl2texinfo. Each element of this list is boolean. Don't edit this option manually, use M-x customize instead.

— User Option: bhl-texi-setchapternewpage-flag

Set the @setchapternewpage value. The default value is on.

— User Option: bhl-texi-titlepage-style

The style of the title page. The classical titlepage is the one mostly used by the GNU manuals. The centered titlepage centers the title and other informations on the front page.

— User Option: bhl-texi-centered-minipage-tag

The default tag used for the conversion of centered minipages. See Environments.

— User Option: bhl-texi-table-tag

The tag for the conversion of tables in the Texinfo output. The default value is verbatim. If you want to skip tables when converting into Texinfo format, you should set this to ignore.

— User Option: bhl-texi-footer

A string that will be put at the end of the Texinfo output.

7.5 BHL to SGML

— User Option: bhl-after-sgml-conversion-hook

Hook run after the SGML conversion.

— User Option: bhl2sgml-properties-list

The list of properties relevant for the bhl2hsgml conversion. See Properties of conversion. Don't modifiy this variable manually. Use M-x customize instead.

— User Option: bhl-sgml-conversions-list

A list of conversions to perform with bhl2sgml. Each element of this list is boolean. Don't edit this option manually, use M-x customize instead.

— User Option: bhl-sgml-list-item-is-para-flag

Non-nil means that list items are paragraphs into the SGML output.

— User Option: bhl-sgml-minipage-tag

The default tag used for the conversion of minipages. See Environments.

— User Option: bhl-sgml-footer

A string that will be put at the end of the SGML output.

7.6 BHL to WIKI

Starting with 1.7.9, BHL implements a bhl2wiki fonction. For now, the conversion is far from perfect, but it may be useful.

— User Option: bhl-after-wiki-conversion-hook

Hook run after the conversion into WIKI. This hook is run just before `bhl-after-conversion-hook'.

— User Option: bhl2wiki-properties-list

List of properties of the `bhl2wiki' conversion.

— User Option: bhl-wiki-conversions-list

A list of conversion functions to perform with `bhl2html'. Each element of this list corresponds to a conversion function.

— User Option: bhl-wiki-footer

A string that will be put at the end of the WIKI output.

7.7 BHL to TXT

— User Option: bhl-after-txt-conversion-hook

Hook run after the TXT conversion.

— User Option: bhl2txt-properties-list

The list of properties relevant for the bhl2txt conversion. See Properties of conversion. Don't modifiy this variable manually. Use M-x customize instead.

— User Option: bhl-txt-conversions-list

A list of conversions to perform with bhl2txt. Each element of this list is boolean. Don't edit this option manually, use M-x customize instead.

7.8 Wiki options

— User Option: bhl-is-a-local-wiki-flag

If non-nil, this means that bhl is a local wiki. You can toggle this variable from the menu.

— User Option: bhl-default-wikifiles-extension

The default extension for the Wiki file names. The default value for this options is .bhl. For example, when following a WikiName named MyWikiName, a new file named MyWikiName.bhl will be found.

— User Option: bhl-downcase-wikifiles-names-flag

If non-nil, following a WikiName named MyWikiName will find a file named mywikiname.bhl, which is the downcased value of the WikiName. Otherwise, it will find a file named MyWikiName.bhl.

— User Option: bhl-non-wiki-names-list

A list of mixed-case strings that should not be considered as WikiNames. For example: “OpenOffice”.

7.9 Options of the toc

— User Option: bhl-default-toc-depth

The default doc depth. The default value is three.

— User Option: bhl-toc-location

Indicates the toc location. This variable may have three different values: top (just after the title), bottom (just before the end) or point (at point).

— User Option: bhl-intro-toc

A string to insert before the table of contents in the source file.

— User Option: bhl-end-toc

A string to insert after the table of contents in the bhl files.

7.10 Converting tables

— User Option: bhl-table-location

Where to put the table. The default value is htbp, i.e. here top bottom page. This variable does not concern the HTML output.

— User Option: bhl-table-align

The table alignment. The default value is center.

— User Option: bhl-table-cell-align

The cell alignment inside a table. The default value is center.

8 Example

     Just ANother Example
     
     --- Table of contents
     
      1. Fonts and environments
        1.1. Using font beautifiers
        1.2. Environments
      2. Converting lists
        2.1. Ordered and non-ordered lists
        2.2. Description lists
        2.3. Nested lists
      3. Converting tables
      4. Browsing your document
        4.1. The table of content
        4.2. The list of links
      5. Contact
     
     --- End of the table of contents
     
     
     # This is the last example of a BHL file converted into HTML, LaTeX
     # and SGML formats.  This example shows you the various syntaxic rules
     # that BHL handles.  For further details, please refer to the manual
     # of the BHL mode. http://www.nongnu.org/bhl
     
     # These lines are comments.
     # You can comment a region with `bhl-comment-region'
     
     # The few next lines are specification lines. They
     # indicate the properties of the different conversions.
     
     #!author!Bastien Guerry
     #!date!It is %Hh%M on %d/%m/%Y.
     
     #!html!toc:nocaption:noprefix:noi18n
     #!sgml!caption
     #!latex!toc:caption:prefix:i18n
     #!latex-options!11pt:a4paper
     #!latex-packages!inputenc[latin1]
     
     This document is a small example of what BHL can do. For further
     details, please read the full documentation on
     http://www.nongnu.org/bhl.
     
     #!language!fr
     #!encoding!iso-8859-1
     #!texi-style!centered
     
     1. Fonts and environments
     
     1.1. Using font beautifiers
     
     Here is a list of the *different* fonts beautifiers that you can
     use inside the BHL mode.
     
     	Bold -- *one or two words.*
     	Emphasis -- _one or two words._
     	Truetype -- ==one or two words.==
     	Underline -- __one or two words.__
     	Bold italic -- _*one or two words*_.
     
     If want to insert an asterisk, you can use the escape character like
     \*this\* or like \_this\_. This is also available for \#comments.
     
     1.2. Environments
     
     BHL handles two specific environments: verbatim and minipage.
     
     Verbatim:
     
     --
     Here is a *part* of text that			will be displayed
     in 	verbatim	                         #a comment
     
     Please remark[1] that this environment has no syntactic rule, except
     you modify the variable bhl-verbatim-ignore.
     
     	* list are ignored
     
     And so do...
     
     	Item -- descriptions.
     
     And so do tables!
     
     | A | B |
     | C | D |
     
     And so do quote environments:
     
         blahblahblah
         blahblahblah
     
     Etc.
     --
     
     
     A minipage:
     
     %%%[12cm]
     This minipage (12cm) is centered without border.
     %%%
     
     <%%[10cm]
     This minipage (10cm) is put on the left without border.
     %%%
     
     >-%[8cm]
     This minipage (8cm) is put on the right with border.
     %%%
     
     A horizontal rule:
     
     ----[3cm]
     
     Another horizontal rule, put on the right:
     
     >---[3cm]
     
     2. Converting lists
     
     2.1. Ordered and non-ordered lists
     
     *Ordered* lists begin with three *whitespaces*, a list separator (\*, - or o)
     and another whitespace.
     
     	* Like this;
     	* or like that.
     
     2.2. Description lists
     
     Description lists are treated like other lists, except that they
     cannot be nested in other lists.
     
     A description item consists in tabs, a term to be defined, a
     whitespace, two dashes and another whitespace.
     
     	Term -- a definition of the terme.
     	Definition -- another definition.
     
     2.3. Nested lists
     
     	* Lists can be nested inside other lists.
     
     		* You just need to add three whitespaces more.
     		* These to items will be nested into two other items. sldkfj
     		  lskdjf lmmlkm
     
     			1. Three levels of nested lists are supported.
     			2. Four levels won't be very useful...
     
     	* Blank lines are not mandatory between items.
     
     3. Converting tables
     
     A WikiName.
     
     Here is a table:
     
     | @dHL et lqskdj@                |  @qsdqsdOolsqdf@      |
     | Free softxware                 |  bastien1@free.fr     |
     | With Emacs                     |  Without Emacs        |
     |  bastien                       |  Without Emacs        |
     
     A table line begins and ends with a "|".  Other "|" inside a line of
     the table separate two cells.  Arobases around the content of a cell
     mean that this cell is a header of the table.
     
     4. Browsing your document
     
     4.1. The table of content
     
     You can _browse_ the table of content, _insert_ it inside your
     document, and _update_ the numbering of sections.
     
     The default key binding for browsing the table of content is C-c
     C-t.
     
     You can also choose the style of sectioning and swith from one style
     to another. The style of this document is set to *num* (which is the
     default style) by the specification line above.
     
     4.2. The list of links
     
     The default key binding for browsing the list of links is C-c
     C-/. This creates a new buffer with a list of URLs or wikinames that
     you can follow.
     
     5. Contact
     
     Please feel free to submit bugs or ideas:
     [[mailto:bastien1@free.fr][BHL contact]].
     
     Footnotes:
     [1]  A note.

9 Index

Thanks

BHL is somewhat related to emacs-wiki.el and muse.el and you should have a look at them. They are more wiki-oriented than BHL and they can be more convenient if you want to convert a lot of pages at the same time. But basically they do the same job.

Thanks to Serge Basterot, Jeffrey Borlik, Christoph Conrad, Tim Cross, Mario Domgörgen, Thomas Gehrlein, Jacob Hamacher, Sylvain Holtzer, Dan P. Katz, Mario Lang, Massimiliano Mirra, Julie Neveux, John Stauffer, Thierry Stoehr and Marco Testi.