Little Girl's Mostly Linux Blog

txt2tagsCheatSheet

txt2tags Cheat Sheet

This page was last updated on February 10, 2017.

Table of Contents

Introduction

  • Why this page? So you can find almost everything you could ever want to do with txt2tags in one cheat sheet!
  • This page was created by Little Girl, who has no connection with the authors of txt2tags other than loving their program. Since this page is so useful to the author, she figured it might be enjoyed by others as well, so it is shared here freely.
  • With txt2tags, you can write documents in plain text using a simple markup language that makes the file easily readable and doesn’t interfere with word counting or spell checking. When finished writing the document, you can use the txt2tags graphical or command line interface to convert it into various types of documents – like a web page, for example. For more information, see the txt2tags home page.
  • See an example page and the txt2tags source document used to create it.
  • See an example of some of the markup.
  • See a thorough demonstration of the txt2tags markup rules and the source file that was used to create it.

Before you begin

A txt2tags source file is made up of three basic areas – the Header Area, the Configuration Area, and the Body Area. A visual representation is shown here:

Header Area
  • This section is required.
  • It begins at the top of the source file.
  • It uses the first 1 to 3 lines.
  • It often contains the title, author’s name, date, and version number.
Configuration Area
  • This section is optional.
  • It begins on the 2nd or 4th line of the source file, depending on how many Header Area lines there are.
  • It uses a varying number of lines.
  • It can be used for settings that determine how the converted target document looks or behaves.
Body Area
  • This section is optional.
  • It begins on the first line following the Configuration Area, or (if no Configuration Area is present) on the first line following the Header Area.
  • It uses a varying number of lines.
  • It is for the main contents or body of your target document.

Header Area

This area is required and uses the first 1 or 3 lines of the txt2tags source file. If the first line is blank, the Header Area is closed and no headings will be displayed at the top of the target document. If the first line contains content, the next 2 lines must be used for the Header Area. The contents of the first line will be displayed as a centered level 1 heading on the first line of your target document. The contents of the second line will be displayed as centered italic text on the second line of your document (if blank, it will not be displayed). The contents of the third line will be displayed as centered plain text on the third line of your document (if blank, it will not be displayed). This area can contain macros. See the Header Area page in the txt2tags User Guide for more information.

First line

The first line is formatted as a level one heading. It can contain the name you want at the top of the document. The first line of this document is an example.

Put this in the Header Area:

Title Of The Document

Second line

The second line is italic. It can contain an attribution, the e-mail address of the author, or one line of any text you like.

Put this in the Header Area:

by Author

Third line

The third line is plain text. It can contain a version number, a last updated line (with the date automatically generated for you by a macro), or one line of any text you like.

Put this in the Header Area:

Last updated: %%mtime(%A %B %d, %Y)


Configuration Area

This area is optional, begins on the 2nd or 4th line of the document (depending on whether your Header Area is blank or has content in it), and can be made up of a varying number of lines. It can contain settings that determine how the converted document looks or behaves. See the Config Area page in the txt2tags User Guide for more information. In this area you can specify various things like encoding, background color, whether or not to use a Table of Contents, the symbols used for line breaks, etc. You can also use Python regular expressions to create filter rules to be used before or after the file is processed by txt2tags. See the Details for PreProc and PostProc Filters page in the txt2tags User Guide for an explanation of how these work. Below are some examples of configuration lines:

Background color

You can define the background color of the converted HTML document by using a setting in the Configuration Area to add the style attribute to the body element of the document after txt2tags processes it. The example uses yellow as the background color. You can change this to any other color as a word or hex code.

Put this in the Configuration Area:

%!postproc: <BODY.*?> <BODY style="background-color:yellow;">

Comments

Begin a line with a percent symbol to create a comment only visible in the raw form of the source file. This way you can add descriptive text above or below the settings in the Configuration Area or anywhere in the Body Area.

Put this in the Configuration Area or the Body Area:

% This is a comment.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%TODO%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Begin a line with a percent symbol to create a comment only visible in the raw form of the source file. This way you can add descriptive text above or below the settings in the Configuration Area.

Put this in the Configuration Area or the Body Area:

				

%%% This is a comment. %%%
CSS

There are several ways to use CSS to style your web pages: You can individually style any part of a page with HTML elements that use the style attribute, you can insert an HTML style element inside of a txt2tags tagged area, you can use the css-sugar method, you can use the style method, or you can use a combination of the css-sugar and style methods.

The css-sugar method is a one-line addition to the Configuration Area that automatically makes several changes to the default styles for you and divides pages into zones, allowing for quite extensive customization, if desired.

Put this in the Configuration Area to use the css-sugar method:

%!options: --css-sugar


The style method is used for customizing pages by using an external CSS file in the same directory as your txt2tags file.

Put this in the Configuration Area, replacing FILENAME with the name of your CSS file to use the style method:

%!style(html): FILENAME


A combination of css-sugar method and the style method would have the advantage of starting with the settings determined by css-sugar and the added advantage of additional styling with the external CSS file.

Put these in the Configuration Area, replacing FILENAME with the name of your CSS file to use the combination css-sugar and style method:

%!options: --css-sugar
%!style(html): FILENAME

Or put this in the Configuration Area, replacing FILENAME with the name of your CSS file to use the combination css-sugar and style method:

%!options: --css-sugar --style FILENAME

Download txt2tagsCSS.zip to see example files using all four methods. Download txt2tagsCSSsidebar.zip for a very basic example of styling a sidebar.


You can define the style of the converted HTML document by using a setting in the Configuration Area to add the style attribute to the body element of the document after txt2tags processes it.

Put this in the Configuration Area, replacing RULES with your CSS rule or rules:

%!postproc: <BODY.*?> <BODY style="RULES">

Encoding

This specifies the type of encoding you’d like the source and target files to use. The example uses UTF-8.

Put this in the Configuration Area:

%!encoding: utf-8

Options

This specifies the default command line options to be used when txt2tags converts the source file. All txt2tags command line options are available. Type txt2tags –help in a terminal window to view them. The first example shows how to tell txt2tags that you’d like a Table of Contents.

Put this in the Configuration Area:

%!options: --toc

You can add more options to the line by separating each from the next with a space. The second example shows how to tell txt2tags that you’d like a Table of Contents and you’d like to use the mycolors.css file to style the target document.

Put this in the Configuration Area:

%!options: --toc --style mycolors.css
Pre-processed plain links

To keep your file neat, you can list links in the Configuration Area, giving each a name. By using the names in the file you can call those links at any time. In the final conversion of the document, txt2tags will replace the names you typed with the raw links. The example uses T2TURL as the name and http://txt2tags.org as the link.

Put this in the Configuration Area:

%!preproc: T2TURL http://txt2tags.org

Put this in the Body Area:

I can use T2TURL anywhere in this document and it will be replaced automatically with the link.

To create this:

I can use http://txt2tags.org anywhere in this document and it will be replaced automatically with the link.

Pre-processed named links

This is similar to the pre-processed plain links, but instead of inserting raw links into the document, it inserts clickable named links. The name can be more than one word, and is case-sensitive by default. This means that if you use the setting in this example, you must type “Wikipedia” into your document with an upper case W to get txt2tags to recognize it and convert it to a clickable link during the conversion.

Put this in the Configuration Area:

%!preproc: (Wikipedia) [\1 http://www.wikipedia.org/]

Put this in the Body Area:

I use Wikipedia.

To create this:

I use Wikipedia.

To create a pre-processed named link that isn’t case sensitive, you must use (?i) in front of the name in the setting. In this example, you can type “Wikipedia” in any case you like (including mixed case), and txt2tags will recognize it and convert it to a clickable link.

Put this in the Configuration Area:

%!preproc: (?i)(Wikipedia) [\1 http://www.wikipedia.org/]

Put this in the Body Area:

I use wikipedia.

To create this:

I use wikipedia.

Or put this in the Body Area:

I use WiKiPeDiA.

To create this:

I use WiKiPeDiA.

Pre-processed replacement text

If you know you’ll be repeatedly typing anything lengthy or complex and would like to use an easy to remember string of text instead, you can define this with a setting in the Configuration Area. Then you can just type the easy to remember string of text in your source file. When txt2tags converts the document it will first find all instances of your easy to remember string of text and replace it with the text you specified in the setting.

Put this in the Configuration Area:

%!preproc: "JFK" "John F. Kennedy"

Put this in the Body Area:

JFK was the 35th President of the United States.

To create this:

John F. Kennedy was the 35th President of the United States.

Table of Contents

This specifies that you’d like a Table of Contents inserted between the Header Area and Body Area of the page (to specify its location see the Table of Contents placement section of this page). Up to three levels of contents will be displayed by default.

Put this in the Configuration Area:

%!options: --toc

If you’d like to define a different number of nesting levels than the default, add the line in this example directly beneath the Table of Contents line, replacing N with 1, 2, 4, or 5.

Put this in the Configuration Area:

%!options: --toc-level N

Target file type

This specifies the type of file you’d like to convert the txt2tags file into. Type txt2tags –targets in a terminal window to see a list of all the possible target file types, and then choose one to convert your document into.

Put this in the Configuration Area:

%!target: html

To create an HTML page.


Body Area

This area is optional and can be made up of a varying number of lines. It begins on the first line after the Configuration Area (or after the Header Area if no configuration was needed) and continues to the end of the document. It can be used for the main contents of your document (which are anything other than Header Area and Configuration Area contents) and all formatting and structures txt2tags can recognize. This area can contain commands and macros, a Table of Contents, different sections, headings, plain text, tables, lists, graphics, inserted files, etc. See the Body Area page in the txt2tags User Guide for more information.

Anchor

To create an anchor, place the text you’d like to use as an anchor in brackets ([ and ]) immediately to the right of the plain or numbered heading you’d like to link to. See the Link – anchor section for instructions on how to link to the anchor.

Put this in the Body Area:

=== This level 3 heading has an anchor ===[anchors_away]

To create this:

This level 3 heading has an anchor

Block – comment

To insert a comment as a block of text into your source file, place three percent symbols (%) on a line by themselves, type or paste the text you’d like to use on the next line or lines, and place three percent symbols on the next line by themselves.

Put this in the Body Area:

%%%
This is a block of comment text.
Marks are not interpreted.
This is only visible in the source file.
%%%

To create a block of text that’s only visible when viewing the source file.

Block – raw

To insert a raw block of text into your document, place three sets of quotes () on a line by themselves, type or paste the text you’d like to use on the next line or lines, and place three sets of quotes on the next line by themselves.

Put this into the Body Area:

"""
This is a block of raw text.
Default font is used.
txt2tags **marks** are not interpreted.
HTML and XHTML <b>marks</b> are not interpreted.
White space is not respected.
Long lines of text will wrap.
"""

To create this:

This is a block of raw text. Default font is used. txt2tags **marks** are not interpreted. HTML and XHTML <b>marks</b> are not interpreted. White space is not respected. Long lines of text will wrap.
Block – tagged

To insert a block of tagged (HTML or XHTML) text into your document, place three single quotes () on a line by themselves, type or paste the text you’d like to use on the next line or lines, and place three single quotes on the next line by themselves.

Put this into the Body Area:

'''
This is a block of tagged text.
Default font is used.
txt2tags **marks** are not interpreted.
HTML and XHTML <b>marks</b> are interpreted.
White    space    is    not    respected.
Long lines of text will wrap.
'''

To create this:

This is a block of tagged text. Default font is used. txt2tags **marks** are not interpreted. HTML and XHTML marks are interpreted. White space is not respected. Long lines of text will wrap.
Block – verbatim

To insert a block of verbatim text in your document, place three backticks (`) on a line by themselves, type or paste the text you’d like to use on the next line or lines, and place three backticks on the next line by themselves.

Put this into the Body Area:

```
This is a block of verbatim text.
Monospace font is used.
**Marks** are not interpreted.
HTML and XHTML <b>marks</b> are not interpreted.
White    space    is    respected.
Long lines of text will not wrap.
```

To create this:

This is a block of verbatim text.
Monospace font is used.
**Marks** are not interpreted.
HTML and XHTML <b>marks</b> are not interpreted.
White    space    is    respected.
Long lines of text will not wrap.

Centered line of text

To center a line of text, put it inside a centered table by inserting a space, a pipe, and another space before the line of text.

Put this in the Body Area:

 | This is a centered line of text.

To create this:

This is a centered line of text.
Centered paragraph (method 1)

To center a paragraph, use the same method as with the centered line of text, creating each line of the paragraph separately. Each line must have a space, a pipe and a space before it.

Put this in the Body Area:

 | This is a centered paragraph. Each line must be
 | coded independently or it will fill the entire
 | screen, in which case you may as well not have
 | bothered centering the text, and it's actually
 | a good idea not to use this method.

To create this:

This is a centered paragraph. Each line must be
coded independently or it will fill the entire
screen, in which case you may as well not have
bothered centering the text, and it’s actually
a good idea not to use this method.
Centered paragraph (method 2)

To center a paragraph, use the same method as with the centered line of text, creating one continuous line of centered text interrupted by inserting forced, coded line breaks in it. This presents a visually more elegant result than the previous method does.

Put this in the Body Area:

 | This is a centered paragraph using@@ forced line breaks for a better@@ look.

To create this:

This is a centered paragraph using
forced line breaks for a better
look.
Colored text

There are several ways to color the text in your document, specifying the color by name, as hexadecimals, as RGB, or as HSL.

One way is to use CSS to color the text in your document.

An alternative is to use HTML elements as inline tagged text.

Put this in the Body Area:

''<span style="color:purple;">''This is colored text''</span>''

Or put this in the Body Area:

''<span style="color:purple;">This is colored text</span>''

To create this:

This is colored text.

In older versions of txt2tags you can use {{double curly braces}} instead of <angled brackets> around HTML elements.

Put this in the Configuration Area:

%!postproc(html): (?<!\{)(?:\{{2})(?!\{)(.+?)(?:\}{2})(?!\}) <\1>

Put this in the Body Area:

{{span style="color:purple;"}}This is colored text{{/span}}

To create this:

This is colored text.

Date

Place this macro anywhere in the Body Area to make txt2tags automatically replace it with the current date.

Put this in the Body Area:

%%date(%m-%d-%Y)

To create this:

02-10-2017

Headings – numbered

Numbered headings are used to name the different sections of your document. The numbering will be done for you automatically depending on the level of heading you choose. To create the various levels of headings, use one, two, three, four, or five plus symbols (+) and a space on either side of the heading text.

Put this into the Body Area:

+ Level one numbered heading +

To create this:

1. Level one numbered heading

Put this into the Body Area:

++ Level two numbered heading ++

To create this:

1.1. Level two numbered heading

Put this into the Body Area:

+++ Level three numbered heading +++

To create this:

1.1.1. Level three numbered heading

Put this into the Body Area:

++++ Level four numbered heading ++++

To create this:

1.1.1.1 Level four numbered heading

Put this into the Body Area:

+++++ Level five numbered heading +++++

To create this:

1.1.1.1.1 Level five numbered heading
Headings – plain

Plain headings are used to name the different sections of your document. To create the various levels of headings, use one, two, or three equal symbols (=) and a space on either side of the heading text.

Put this into the Body Area:

= Level one heading =

To create this:

Level one heading

Put this into the Body Area:

== Level two heading ==

To create this:

Level two heading

Put this into the Body Area:

=== Level three heading ===

To create this:

Level three heading

Put this into the Body Area:

==== Level four heading ====

To create this:

Level four heading

Put this into the Body Area:

===== Level five heading =====

To create this:

Level five heading
Horizontal rule (separator) – thin

Horizontal rules (separators) are used to divide up the page into different sections. All horizontal rules will fill the entire width of the page automatically. A thin horizontal rule can be created by typing 20 or more dashes () or underscores (_) in a row.

Put this in the Body Area:

--------------------

Or put this in the Body Area:

____________________

To create this:


Horizontal rule (separator) – thick

Horizontal rules (separators) are used to divide up the page into different sections. All horizontal rules will fill the entire width of the page automatically. A thick horizontal rule can be created by typing 20 or more equal symbols (=) in a row.

Put this in the Body Area:

====================

To create this:


HTML elements

You can use inline tagged text to insert HTML elements in your document. You can tag just the elements or the elements and their contents.

Put this in the Body Area:

''<p style="color:red;font-weight:bold;">''This is bold red text.''</p>''

Or put this in the Body Area:

''<p style="color:red;font-weight:bold;">This is bold red text.</p>''

To create this:

This is bold red text.

If you use an older version of txt2tags or would like some syntax that’s very similar to the style of most txt2tags syntax, you can use a setting in the Configuration Area to define a filter that replaces double curly brackets with single angled brackets when it converts the file. Then you can insert HTML elements into your document by using {{double curly braces}} instead of <angled brackets> to surround the elements.

Put this in the Configuration Area:

%!postproc(html): (?<!\{)(?:\{{)(?!\{)(.+?)(?:\}})(?!\}) <\1>

Put this in the Body Area:

{{p style="color:red;font-weight:bold;"}}This is bold red text.{{/p}}

To create this:

This is bold red text.

Image

To include an image in a document, it must be in the form of a link, which can be made by surrounding the image file name with square brackets ([ and ]).

Put this in the Body Area:

[txt2tagsimage.png]

To create this:

Image alignment

To align an image to the left, put the image link on a line by itself.

Put this in the Body Area:

[txt2tagsimage.png]

To create this:

To align an image in the center, insert a space before and after the image link.

Put this in the Body Area:

 [txt2tagsimage.png] 

To create this:

To align an image to the right, insert a space before the image link.

Put this in the Body Area:

 [txt2tagsimage.png]

To create this:

Image alignment with text

Images can be aligned with text by being placed to the left, center, or right of text. Insert a space between the text and the image link. The left-aligned image may need to be placed inside a table with or without borders to control its behavior. The center-aligned image seems to behave without needing to be inside a table. The right-aligned image may need to be placed inside a table with or without borders to control its behavior.

Put this in the Body Area:

| [txt2tagsimage.png] left aligned

To create this:

left aligned

Put this in the Body Area:

| center [txt2tagsimage.png] aligned

To create this:

center aligned

Put this in the Body Area:

| right aligned [txt2tagsimage.png]

To create this:

right aligned
Images connected together

You can connect together any number of images. You may need to place the image links in a table with or without borders to control their behavior unless you surround them with text. Spaces are respected during conversion if you’d like to separate them from one another.

Put this in the Body Area:

| [txt2tagsimage.png][txt2tagsimage.png][txt2tagsimage.png][txt2tagsimage.png][txt2tagsimage.png]

To create this:

Images mixed with text

As long as images are surrounded by text, they will appear exactly where you insert them. A table isn’t necessary in this case. Insert a space between the text and the image links.

Put this into the Body Area:

Images [txt2tagsimage.png] mixed [txt2tagsimage.png] with [txt2tagsimage.png] text.

To create this:

Images mixed with text.

Include CSV file

To include a CSV file as a table, you can use a CSV include command. Each comma separated value will be placed in its own cell in the table. Note that if you change an included file, you will need to reconvert the txt2tags document so the changes will be included. See my txt2tagsincludecommands.zip file for a demonstration.

Put this into the Body Area:

%!csv: ''example.csv''

To create this:

this is a sample
Include HTML file

To include an HTML file as a tagged area, you can use an include command with the filename surrounded by two sets of single quotes. The background color of the HTML file (if specified) is used for the entire document. If more than one HTML file is included, the background color (if specified) of the first included HTML file will be used for the entire document. Text color, formatting and alignment are honored, as well as background and border color of tables. Note that if you change an included file, you will need to reconvert the txt2tags document so the changes will be included. See my txt2tagsincludecommands.zip file for a demonstration.

Put this into the Body Area:

%!include: ''example.html''

To create this:

HTML Sample


This is a sample.

column one row one column two row one
column one row two column two row two
Include text file as raw block

To include a text file raw, running all the text together, you can use an include command with the filename surrounded by two sets of double quotes. Note that if you change an included file, you will need to reconvert the txt2tags document so the changes will be included. See my txt2tagsincludecommands.zip file for a demonstration.

Put this in the Body Area:

%!include: ""example.txt""

To create this:

Text Sample This is a sample.

Include text file verbatim

To include a text file exactly as you typed it, respecting text position and line breaks, but inserting a blank line above and below your contents, you can use an include command with the filename surrounded by two sets of backticks. Note that if you change an included file, you will need to reconvert the txt2tags document so the changes will be included. See my txt2tagsincludecommands.zip file for a demonstration.

Put this in the Body Area:

%!include: ``example.txt``

To create this:

				

Text Sample This is a sample.
Include txt2tags file

To include the Body Area of a txt2tags file inside the current txt2tags file, you can use an include command in the Configuration Area. This is useful for breaking up a large document into manageable pieces. Note that if you change an included file, you will need to reconvert the txt2tags document so the changes will be included. See my txt2tagsincludecommands.zip file for a demonstration.

Put this in the Body Area:

%!include: example.t2t

To create this:

txt2tags Sample

This is a sample.

Inline – bold

To format inline text in bold, surround it with two asterisks (*) on each side.

Put this in the Body Area:

**This is bold text.**

To create this:

This is bold text.

Inline – italic

To format inline text in italic, surround it with two forward slashes (/) on each side.

Put this in the Body Area:

//This is italic text.//

To create this:

This is italic text.

Inline – mixed

Text can be formatted in more than one way at once with any combination of bold, italic, verbatim (monospaced), strike-through, or underlined text. You can do this by surrounding the text with the characters needed to achieve one type of formatting and then surround the text and those characters with the characters for another type of formatting. Continue in this way until you have applied all the formats you like to your text. Note that the backticks for verbatim (monospaced) text must always be at the inside of any other characters surrounding the text and the dashes for strikethrough text must always be at the outside of any other characters surrounding the text.

Put this in the Body Area:

**//__This is bold italic underlined text.__//**

To create this:

This is bold italic underlined text.

Or put this in the Body Area:

--**//__``This is strikethrough bold italic underlined verbatim text.``__//**--

To create this:

This is strikethrough bold italic underlined verbatim text.

Inline – monospaced

See the inline verbatim section.

Inline – plain

To create plain text, type it into a document as is.

Put this in the Body Area:

This is plain text.

To create this:

This is plain text.

Inline – raw

To format inline text as raw, surround it with two double quotes () on each side. Default font is used, txt2tags **marks** are not interpreted, HTML and XHTML <b>marks</b> are not interpreted. White space is not respected. Text will wrap if necessary.

Put this into the Body Area:

""This is inline raw text.""

To create this:

This is inline raw text.

Inline – strike-through

To format inline text as strike-through, surround it with two dashes () on each side.

Put this in the Body Area:

--This is inline strike-through text.--

To create this:

This is inline strike-through text.

Inline – tagged

To insert tagged (HTML or XHTML) text into your document, surround it with two single quotes () on each side. You can tag only the elements or the elements and their contents. Default font is used. txt2tags **marks** are not interpreted. HTML and XHTML <b>marks</b> are interpreted. White space is not respected. Text will wrap if necessary.

Put this into the Body Area:

''This is inline tagged text.''

To create this:

This is inline tagged text.

Inline – underlined

To format inline text as underlined, surround it with two underscores (_) on each side.

Put this in the Body Area:

__This is underlined text.__

To create this:

This is underlined text.

Inline – verbatim

To format inline text as verbatim (monospaced), surround it with two backticks () on each side. Monospace font is used. **Marks** are not interpreted. HTML and XHTML <b>marks</b> are not interpreted. White space is respected. Text will wrap if necessary.

Put this into the Body Area:

``This is verbatim text.``

To create this:

This is verbatim text.

Line break

Line breaks (forced blank lines) can be added to HTML documents by inserting HTML <br> elements as inline tagged text, by surrounding the HTML elements with two apostrophes (') on each side.

Put this in the Body Area:

This text''<br>''has a line break.

To create this:

This text
has a line break.

In older versions of txt2tags you can use a pre-processing setting in the Configuration Area, defining a label and the text it should be replaced with on conversion. Then use the label in your text and txt2tags will replace it when it converts the file. In the example, @@ was used to represent the HTML <br> element.

Put this in the Configuration Area:

%!postproc(html): @@ <br>

Put this in the Body Area:

This text@@has a line break.

To create this:

This text
has a line break.

Line – comment

To insert a comment only visible in the source file, insert 3 percent symbols (%) followed by a space at the beginning of a line of text.

Put this in the Body Area:

%%% This is a comment line.

Line – raw

To insert a line of raw text into your document, insert three sets of quotes (") followed by a space at the beginning of a line of text. Default font is used, txt2tags **marks** are not interpreted, HTML and XHTML <b>marks</b> are not interpreted. White space is not respected. Text will wrap if necessary.

Put this into the Body Area:

""" This is a line of raw text.

To create this:

This is a line of raw text.

Line – tagged

To insert a tagged (HTML or XHTML) line of text into your document, insert three single quotes (') followed by a space at the beginning of a line of text. Default font is used. txt2tags **marks** are not interpreted. HTML and XHTML <b>marks</b> are interpreted. White space is not respected. Text will wrap if necessary.

Put this into the Body Area:

''' This is a line of tagged text.

To create this:

This is a line of tagged text.

Line – verbatim

To insert a verbatim line of text into your document, insert three backticks (`) and a space before a line of text. Monospace font is used. **Marks** are not interpreted. HTML and XHTML <b>marks</b> are not interpreted. White space is respected. Text will not wrap.

Put this into the Body Area:

``` This is a line of verbatim text.

To create this:

This is a line of verbatim text.

Link – anchor

To use an anchor, insert a labeled link made of a square bracket ([) plus the label plus a space plus a hash mark (#) plus the anchor text plus a closing square bracket (]).

Put this in the Body Area:

Use [the anchor #anchors_away] you created.

To create this:

Use the anchor you created.

Link – email

To create an email link, you can type the address as is or surround it in square brackets ([ and ]) and it will be formatted as a clickable link for you in the converted file.

Put this in the Body Area:

name@domain.com

Or put this in the Body Area:

[name@domain.com]

To create this:

name@domain.com

To create it as a labeled link in your document, type the label, a space, and the address inside of square brackets.

Put this in the Body Area:

[label name@domain.com]

To create this:

label

Link – image

To create a clickable image link, insert an image filename in square brackets, a space, and a URL inside of square brackets.

Put this in the Body Area:

[[txt2tagsimage.png] http://txt2tags.org]

To create this:

Link – labeled

To create a labeled clickable link in your document, type the label, a space, and the URL inside of square brackets.

Put this in the Body Area:

[This is a link http://txt2tags.org]

To create this:

This is a link

Link – plain

To create a plain link, you can type the URL address as is or surround it in square brackets and it will be formatted as a clickable link for you in the converted file.

Put this in the Body Area:

http://txt2tags.org

Or put this in the Body Area:

[http://txt2tags.org]

To create this:

http://txt2tags.org

List – bulleted

A bulleted list is created by using a dash () and a space before each item. To make a nested item, indent the dash one or more spaces. You can have as many nested levels as you like. You can reverse nest only if you’ve nested to begin with. Insert a blank line after each item on the list if you like. Close the list with an empty item (a and a space) or with two blank lines beneath the list, either of which show up as one blank line in the converted document. If the list ends on a nested item, close the nested level with an empty item and close the list with an empty item, or insert two blank lines after the last item in the list.

Put this in the Body Area:

- item one
- item two
- item three
 - nested item one
 - nested item two
 - nested item three
- item four
- item five
- item six
- 

Or put this in the Body Area:

- item one
- item two
- item three
 - nested item one
 - nested item two
 - nested item three
- item four
- item five
- item six


To create this:

  • item one
  • item two
  • item three
    • nested item one
    • nested item two
    • nested item three
  • item four
  • item five
  • item six
List – definition

A definition list is created by using a colon (:) and a space before each word you wish to define, and putting the definition on the next line. Insert a blank line after each item on the list if you like. Close the list with an empty item (a : and a space) or with two blank lines beneath the list, either of which show up as one blank line in the converted document.

Put this in the Body Area:

: word one
definition of word one
: word two
definition of word two
: word three
definition of word three
: 

Or put this in the Body Area:

: word one
definition of word one
: word two
definition of word two
: word three
definition of word three


To create this:

word one
definition of word one
word two
definition of word two
word three
definition of word three
List – numbered

A numbered list is created by using a plus symbol (+) and a space before each item. To make a nested item, indent the + one or more spaces. You can have as many nested levels as you like. You can reverse nest only if you’ve nested to begin with. Insert a blank line after each item on the list if you like. Close the list with an empty item (a + and a space) or with two blank lines beneath the list, either of which show up as one blank line in the converted document. If the list ends on a nested item, close the nested level with an empty item and close the list with an empty item, or insert two blank lines after the last item in the list.

Put this in the Body Area:

+ item one
+ item two
+ item three
 + sub-item one
 + sub-item two
 + sub-item three
+ item four
+ item five
+ item six
+ 

Or put this in the Body Area:

+ item one
+ item two
+ item three
 + sub-item one
 + sub-item two
 + sub-item three
+ item four
+ item five
+ item six


To create this:

  1. item one
  2. item two
  3. item three
    1. sub-item one
    2. sub-item two
    3. sub-item three
  4. item four
  5. item five
  6. item six
List – mixed

A mixed list is a combination of a bulleted list and a numbered list. Follow the same rules when creating this list. Close the list with an empty item of either kind (a and a space or a + and a space) or with two blank lines beneath the list, either of which show up as one blank line in the converted document. If the list ends on a nested item, close the nested level with an empty item and close the list with an empty item, or insert two blank lines after the last item in the list.

Put this in the Body Area:

- item one
- item two
- item three
 + nested item one
 + nested item two
 + nested item three
  - nested item one
  - nested item two
  - nested item three
 + nested item one
 + nested item two
 + nested item three
- item four
- item five
- item six
- 

Or put this in the Body Area:

- item one
- item two
- item three
 + nested item one
 + nested item two
 + nested item three
  - nested item one
  - nested item two
  - nested item three
 + nested item one
 + nested item two
 + nested item three
- item four
- item five
- item six


To create this:

  • item one
  • item two
  • item three
    1. nested item one
    2. nested item two
    3. nested item three
      • nested item one
      • nested item two
      • nested item three
    4. nested item one
    5. nested item two
    6. nested item three
  • item four
  • item five
  • item six
Macros

Macros are shortcuts that can insert dynamic contents in the Body Area of your document. The available macros are:

  • %%date

    • Insert the current date in YYYYMMDD format.
  • %%infile

    • Insert the source file path.
  • %%mtime

    • Insert the source file modification time in YYYYMMDD format.
  • %%outfile

    • Insert the output file path.
  • %%toc

    • Specifies where the Table of Contents will be placed. Can be used multiple times. Must be at the beginning of a line and must be used with the –toc option.

The default behavior of most macros can be customized with special directives like %Y and %f. See the txt2tags User Guide for details. Macros accept several formatting directives. The full list can be found on the Python site.

Put this in the Body Area:

The current date is: is %%date(%B %d, %Y)

To create this:

To insert the current date in Month, DD, YYYY format.

Put this in the Body Area:

Click [here %%infile] to see the source file.

To insert a link to the input (source) file.

Put this in the Body Area:

The %%infile(%f) file was used to create this document.

To insert the path to the input (source) file.

Put this in the Body Area:

Last modified: %%mtime(%B %d, %Y)

To insert the source file modification time in Month, DD, YYYY format.

Put this in the Body Area:

The %%outfile file is the target, but I could just as easily have said the %%outfile(%f) file is the target.

To insert the output (target) file path.

See the Table of Contents placement section for information on using the %%toc macro.

Non-breaking space

To create a non-breaking (fixed) space which can be used to control the placement of text, images or tables in an HTML document, you can insert the HTML &nbsp; code as inline tagged text, by surrounding it with two apostrophes (') on each side.

Put this in the Body Area:

TEST''&nbsp;''TEST

TEST''&nbsp;&nbsp;&nbsp;''TEST

TEST''&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;''TEST

To create this:

TEST TEST

TEST   TEST

TEST     TEST

If you use an older version of txt2tags, you can add a pre-processed replacement text setting in the Configuration Area specifying the text you’d like txt2tags to convert into a non-breaking space. Then insert that text (in the example I use two hash marks) into your document wherever you’d like a non-breaking space.

Put this in the Configuration Area:

%!postproc(html): ## &nbsp;

Put this in the Body Area:

TEST##TEST

TEST######TEST

TEST##########TEST

To create this:

TEST TEST

TEST   TEST

TEST     TEST

Quotes

To add a quote, press the Tab key at the beginning of a line of text (or a word). Nesting is done by indenting more than once with multiple presses of the Tab key. The number of nested levels is unlimited. You can nest, reverse nest, or randomly mix nesting levels.

Put this in the Body Area:

	quote
		quote
			quote
		quote
	quote

To create this:

	quote
		quote
			quote
		quote
	quote

Symbols – copyright © registered ® trademark ™

You can copy and paste the © and/or ® and/or ™ symbols into your text, but you may need to specify the encoding to make sure they appear properly in the finished document (UTF-8 encoding should allow any symbols you might need to display). Alternatively, you can let txt2tags create the symbols for you during the document conversion by inserting an HTML element as inline tagged text in the Body Area.

Put this into the Body Area:

''&copy;''

To create this:

©

Put this into the Body Area:

''&reg;''

To create this:

®

Put this into the Body Area:

''™''

To create this:

In older versions of txt2tags you can use a pre-processing setting for each symbol in the Configuration Area, defining a label and the text it should be replaced with on conversion. Then use the label in your text and txt2tags will replace it when it converts the file. In the examples, the back slashes prevent txt2tags from interpreting the brackets.

Put this into the Configuration Area:

%!postproc(html): \(C\) &copy;

Put this into the Body Area:

(C)

To create this:

©

Put this into the Configuration Area:

%!postproc(html): \(R\) &reg;

Put this into the Body Area:

(R)

To create this:

®

Put this into the Configuration Area:

%!postproc(html): \(TM\) ™

Put this into the Body Area:

(TM)

To create this:

Table

To create a table, open each cell with a pipe ( | ) before the cell contents. Each pipe should be separated from the cell contents with a space. Inline marks are interpreted in tables.

Put this into the Body Area:

| 1 | 2 | 3
| 1 | 2 | 3
| 1 | 2 | 3

To create this:

1 2 3
1 2 3
1 2 3

To add a border to the table, close the first line of the table (its last cell) with a pipe. You can also close all other lines of the table with a pipe if you like, but this is not necessary.

Put this into the Body Area:

| 1 | 2 | 3 |
| 1 | 2 | 3 |
| 1 | 2 | 3 |

To create this:

1 2 3
1 2 3
1 2 3
Table alignment

Tables are aligned to the left by default. To align a table to the center, add a space before the first pipe on each line.

Put this into the Body Area:

 | 1 | 2 | 3
 | 1 | 2 | 3
 | 1 | 2 | 3

To create this:

1 2 3
1 2 3
1 2 3

To add a border to the table, close the first line of the table (its last cell) with a pipe. You can also close all other lines of the table with a pipe if you like, but this is not necessary.

Put this into the Body Area:

 | 1 | 2 | 3 |
 | 1 | 2 | 3 |
 | 1 | 2 | 3 |

To create this:

1 2 3
1 2 3
1 2 3

To align a table to the right, you can add a setting to the Configuration Area that adds a style attribute to the HTML <table> elements.

Put this into the Configuration Area:

%!postproc(html): '(?i)(<table)' '\1 style="margin-left:auto;margin-right:0;"'

Put this into the Body Area:

| 1 | 2 | 3
| 1 | 2 | 3
| 1 | 2 | 3

To create this:

1 2 3
1 2 3
1 2 3

To add a border to the table, close the first line of the table (its last cell) with a pipe. You can also close all other lines of the table with a pipe if you like, but this is not necessary.

Put this into the Configuration Area:

%!postproc(html): '(?i)(<table)' '\1 style="margin-left:auto;margin-right:0;"'

Put this into the Body Area:

| 1 | 2 | 3 |
| 1 | 2 | 3 |
| 1 | 2 | 3 |

To create this:

1 2 3
1 2 3
1 2 3

Table cell alignment

The width of table cells is determined by their contents. Placement of the contents within the cells determines their alignment. Additional spaces to the left or right or both sides of the contents can cause it to be aligned to the right, left, or center.

Put this into the Body Area:

|           XXX |           XXX |
| XXX           | XXX           |
|      XXX      |      XXX      |
| XXXXXXXXXXXXX | XXXXXXXXXXXXX |

To create this:

XXX XXX
XXX XXX
XXX XXX
XXXXXXXXXXXXX XXXXXXXXXXXXX
Table column spans

To span columns with table cells, you can add an extra pipe ( |) to the right side of any cell for each cell that is spanned. If your contents span two cells, there should be two pipes to the right of the cell; if it spans three cells, there should be three pipes to the right of the cell, and so on. In a table with no borders, adding a pipe to the right side of the last cell on any line but the first one (because that would give the table a border rather than spanning cells) will span the cells.

Put this into the Body Area:

| 1 | 2 | 3 | 4 | 5
| 12 || 3 | 4 | 5
| 123 ||| 4 | 5
| 1234 |||| 5
| 12345 |||||

To create this:

1 2 3 4 5
12 3 4 5
123 4 5
1234 5
12345

To add a border to the table, close the first line of the table (its last cell) with a pipe. You can also close all other lines of the table with a pipe if you like, but this is not necessary.

Put this into the Body Area:

| 1 | 2 | 3 | 4 | 5 |
| 12 || 3 | 4 | 5 |
| 123 ||| 4 | 5 |
| 1234 |||| 5 |
| 12345 |||||

To create this:

1 2 3 4 5
12 3 4 5
123 4 5
1234 5
12345
Table heading

To add a heading row to a table, open the first cell on the first line of the table with two pipes instead of one.

Put this into the Body Area:

|| 1 | 2 | 3
| 1 | 2 | 3
| 1 | 2 | 3

To create this:

1 2 3
1 2 3
1 2 3

To add a border to the table, close the first line of the table (its last cell) with a pipe. You can also close all other lines of the table with a pipe if you like, but this is not necessary.

Put this into the Body Area:

|| 1 | 2 | 3 |
| 1 | 2 | 3 |
| 1 | 2 | 3 |

To create this:

1 2 3
1 2 3
1 2 3
Table heading alignment

Table headings align to the center by default. To align them to the left or right, you can add a setting to the Configuration Area that adds a style attribute to the HTML <th> elements.

Put this into the Configuration Area:

%!postproc(html): '(?i)(<TH)' '\1 style="text-align:left;"'

To align table headings to the left.

Put this into the Configuration Area:

%!postproc(html): '(?i)(<TH)' '\1 style="text-align:right;"'

To align table headings to the right.

Table mixed alignment

Tables can contain a mixture of different types of table cell alignment and table column spans.

Put this into the Body Area:

| XXXXXXX | XXXXXXX
|         | XXXXXXX
| XXXXXXX | XXXXXXX
| XXXXXXX |
| XXXXXXX | XXXXXXX
|      XXXXXXX      ||
| XXXXXXX | XXXXXXX

To create this:

XXXXXXX XXXXXXX
XXXXXXX
XXXXXXX XXXXXXX
XXXXXXX
XXXXXXX XXXXXXX
XXXXXXX
XXXXXXX XXXXXXX

To add a border to the mixed structure table, close the first line of the table (its last cell) with a pipe. You can also close all other lines of the table with a pipe if you like, but this is not necessary. If you use non-breaking spaces in the empty cells, those cells will get a border.

Put this into the Body Area:

| XXXXXXXXXX | XXXXXXXXXX |
| ''&nbsp;'' | XXXXXXXXXX |
| XXXXXXXXXX | XXXXXXXXXX |
| XXXXXXXXXX | ''&nbsp;'' |
| XXXXXXXXXX | XXXXXXXXXX |
|       XXXXXXXXXX       ||
| XXXXXXXXXX | XXXXXXXXXX |

To create this:

XXXXXXXXXX XXXXXXXXXX
  XXXXXXXXXX
XXXXXXXXXX XXXXXXXXXX
XXXXXXXXXX  
XXXXXXXXXX XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX XXXXXXXXXX

The height of cells is determined by their contents. The use of styled HTML elements around the contents of a cell and/or HTML line breaks in a cell can force its contents to the top, bottom or center.

Put this in the Body Area:

| XXXXXXX''<br>''XXXXXXX''<br>''XXXXXXX | XXXXXXX
| XXXXXXX''<br>''XXXXXXX''<br>''XXXXXXX''<br>''XXXXXXX | XXXXXXX
| XXXXXXX''<br>''XXXXXXX''<br>''XXXXXXX | ''<span style="position:relative; bottom:19px;">''XXXXXXX''</span>''
| XXXXXXX''<br>''XXXXXXX''<br>''XXXXXXX | ''<span style="position:relative; top:19px;">''XXXXXXX''</span>''

To create this:

XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX

To add a border to the table, close the first line of the table (its last cell) with a pipe. You can also close all other lines of the table with a pipe if you like, but this is not necessary.

Put this in the Body Area:

| XXXXXXX''<br>''XXXXXXX''<br>''XXXXXXX | XXXXXXX |
| XXXXXXX''<br>''XXXXXXX''<br>''XXXXXXX''<br>''XXXXXXX | XXXXXXX |
| XXXXXXX''<br>''XXXXXXX''<br>''XXXXXXX | ''<span style="position:relative; bottom:19px;">''XXXXXXX''</span>'' |
| XXXXXXX''<br>''XXXXXXX''<br>''XXXXXXX | ''<span style="position:relative; top:19px;">''XXXXXXX''</span>'' |

To create this:

XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
Table of Contents placement

The Table of Contents will be inserted between the Header Area and Body Area of the page by default. If you’d like to specify a different location for it, place this code on a line by itself in the location you’d like the Table of Contents to show up, adding a blank line before and after it. Can be used multiple times. Must be at the beginning of a line and must be used with the –toc option.

Put this into the Body Area:

%%toc

Create the target file or change it if it already exists

Now that you’ve written your source file document, you can create the target file on the command line or in the txt2tags graphical user interface. These same instructions can be used to change the target file if it already exists and if you’ve made changes to the source file.

  • To use the command line:

    • If you’ve specified a target file type in the Configuration area of your document:

      • If your terminal window is open in a different directory than the source file:

        • In GNU/Linux and on a MAC, type this command, replacing PATH with the path to the source file on your computer and SOURCEFILENAME with the name of your sourcefile:

          txt2tags /PATH/SOURCEFILENAME
        • In Windows, type this command, replacing PATH with the path to the source file on your computer and SOURCEFILENAME with the name of your sourcefile:

          txt2tags PATH\SOURCEFILENAME
      • If your terminal window is open in the same directory as the source file, type this command, replacing SOURCEFILENAME with the name of your sourcefile:

        txt2tags SOURCEFILENAME
    • If you’ve haven’t specified a target file type in the Configuration area of your document:

      • If your terminal window is open in a different directory than the source file:

        • In GNU/Linux and on a MAC, type this command, replacing TARGETFILETYPE with the type of target and PATH with the path to the source file on your computer and SOURCEFILENAME with the name of your sourcefile:

          txt2tags -t TARGETFILETYPE /PATH/SOURCEFILENAME
        • In Windows, type this command, replacing TARGETFILETYPE with the type of target and PATH with the path to the source file on your computer and SOURCEFILENAME with the name of your sourcefile:

          txt2tags -t TARGETFILETYPE PATH\SOURCEFILENAME
      • If your terminal window is open in the same directory as the source file, type this command, replacing TARGETFILETYPE with the type of target and SOURCEFILENAME with the name of your sourcefile:

        txt2tags -t TARGETFILETYPE SOURCEFILENAME
  • To use the txt2tags graphical user interface (GUI):

    1. Open the GUI:

      • From a shortcut:

        1. Create a shortcut with txt2tags –gui as the command.
        2. Click the shortcut from then on to launch the txt2tags GUI interface.
      • From a terminal window:

        1. Open a terminal window.
        2. Type txt2tags –gui into the terminal window and press the Enter key to launch the txt2tags GUI interface.
    2. Click the Browse button.
    3. Browse to the source (.t2t) file.
    4. Click the Open button.
    5. Click the drop-down to choose the target document type.
    6. Click in any of the optional option boxes to choose them.
    7. Click the Convert! button.

Try txt2tags online

Use the txt2tags free online conversion page to try out various rules or types of syntax online.

Obligatory happy ending

And they all lived happily ever after. The end.

Back to top

20 Comments »

  1. Thank you for this good – example based! – overview: I’m using it regularly for searching some tags2html feature.

    Comment by hartrock — July 4, 2009 @ 9:20 pm

    • Sorry: of course it has to be ‘.. some ***txt2tags*** feature ..’ ;-)

      Comment by hartrock — July 4, 2009 @ 9:26 pm

    • You’re welcome – I’m glad you like it!

      Comment by mostlylinux — July 5, 2009 @ 12:48 pm

  2. Hello,

    I have a doubt: how can you create a table alignment mixed in VERTICAL structure? Is it possible in t2t format?!
    At t2t web site you show the creation of a table alignment mixed in horizontal structure

    Best regars,

    Marcos

    Comment by Marcos Rodrigo — October 9, 2009 @ 1:48 pm

    • If I understand your question, then hopefully the new Table alignment mixed structure vertical (HTML only) section above covers it. I also renamed the Table alignment mixed structure section to Table alignment mixed structure horizontal (HTML only) since that’s more accurate. Let me know if you had something entirely different in mind, and I’ll see what I can work up. (:

      Comment by mostlylinux — October 10, 2009 @ 7:18 am

      • Hi,
        I’m very greatful by the support. Very helpful your tips!

        Regards,

        Marcos

        Comment by Marcos Rodrigo — November 16, 2009 @ 8:10 am

  3. Thank you for this write-up. This saves me a lot of time. I like your explanation on the use of the headers, something I skipped in the overview on the txt2tags home-pages and gave me a lot of errors. I use txt2tags mainly when I write text in a minimal word-processor environment like PyRoom or JDarkroom.

    Comment by Markus Keuter — August 24, 2010 @ 3:49 am

    • You’re welcome! They’re important, so it’s a good thing you found out about them. :)

      I hope the page is still generally useful. It’s been almost a year since I’ve updated it, and there’s probably new syntax that I should add.

      Comment by mostlylinux — August 25, 2010 @ 10:00 am

  4. I discovered Python only recently and while looking for modules to generate HTML files, I found your article on txt2tags that I like a lot.

    These things are new for me me and I need all the help I can find. And your article fits the bill perfectly. It is very helpful.

    Thanks for it, and keep on working on it if you can.

    Comment by gtech — September 3, 2010 @ 5:28 pm

    • I’m happy to be able to help, and I’m glad you like it. I hope to be updating it soon. :)

      Comment by mostlylinux — September 5, 2010 @ 1:31 pm

  5. […] Voor een goed overzicht van alle tags verwijs ik naar de blog van Little Girl mostlylinux.wordpress.com […]

    Pingback by Tikken zonder afleiding | Markus Keuter's Blog — September 20, 2010 @ 4:52 am

  6. I know this website gives quality dependent content
    and additional stuff, is there any other web site which provides such information in
    quality?

    Comment by roof repair sydney service — August 31, 2013 @ 7:37 am

    • You can get great up-to-date information at the official txt2tags website here.

      Comment by mostlylinux — September 8, 2013 @ 6:36 pm

  7. […] Voor een goed overzicht van alle tags verwijs ik naar de blog van Little Girl mostlylinux.wordpress.com […]

    Pingback by Tikken zonder afleiding | sorkusPress — June 10, 2014 @ 9:43 am

  8. Is it possible to create footnotes?

    Comment by Javier Villate — April 4, 2016 @ 8:10 am

    • You could try using an anchor (shown in the page above) by putting this in the configuration area:

      %!postproc(html): (?<!\{)(?:\{{)(?!\{)(.+?)(?:\}})(?!\}) <\1>

      And then putting this in the body of the page:

      TEXT ONE{{sup}}[1 #footnote1]{{/sup}}
      TEXT TWO{{sup}}[2 #footnote2]{{/sup}}
      TEXT THREE{{sup}}[3 #footnote3]{{/sup}}
      TEXT FOUR{{sup}}[4 #footnote4]{{/sup}}

      YOUR ADDITIONAL CONTENTS HERE

      {{hr}}

      ===== FOOTNOTE ONE TEXT =====[footnote1]
      ===== FOOTNOTE TWO TEXT =====[footnote2]
      ===== FOOTNOTE THREE TEXT =====[footnote3]
      ===== FOOTNOTE FOUR TEXT =====[footnote4]

      The drawbacks of this method are that the anchor has to be linked to a heading, and the smallest heading is a level 5. You could style the page to make level 5 headings look like regular text (or however you’d like them to look), but you’d run into issues like not being able to create multi-line footnotes, not being able to have links in footnotes, etc. Also, when using this method, the footnote can’t link back to the original link, although the user could use the browser’s back button to return to it from the footnote.

      If you’d rather have full control over how the footnotes behave and are displayed, you could set up some Pre-processed replacement text (shown in the page above) to insert HTML code that would create the footnotes. Example of the kind of HTML code you might want to get txt2tags to put into your page:

      TEXT ONE<sup><a href="#footnote1" id="link1">1</a></sup>
      TEXT TWO<sup><a href="#footnote2" id="link2">2</a></sup>
      TEXT THREE<sup><a href="#footnote3" id="link3">3</a></sup>
      TEXT FOUR<sup><a href="#footnote4" id="link4">4</a></sup>

      YOUR ADDITIONAL CONTENTS HERE

      <hr>

      <footer>
      <div id="footnote1"><a href="#link1">[1]</a> FOOTNOTE ONE</div>
      <div id="footnote2"><a href="#link2">[2]</a> FOOTNOTE TWO</div>
      <div id="footnote3"><a href="#link3">[3]</a> FOOTNOTE THREE</div>
      <div id="footnote4"><a href="#link4">[4]</a> FOOTNOTE FOUR</div>
      </footer>

      I hope this was of some use. If not, let me know and I’ll mess around and see if I can’t figure out some other way of doing them. I’m sure there are more elegant solutions than these two, but it’s a start and maybe your creativity will go a lot further than mine did. (:

      Comment by mostlylinux — April 4, 2016 @ 6:06 pm

  9. I would love to be able to bold a command within verbatim text block but have the result of the command not bold. i.e. where id is bold only. Is there any way of doing that.

    “`
    ~ $ id
    uid=1000(dobriain) gid=1000(dobriain) groups=1000(dobriain),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),130(sambashare)

    “`

    Comment by Diarmuid O'Briain — December 21, 2016 @ 4:40 pm

  10. I was looking for a way to bold selected text within verbatim blocks. I see there is not a simple way. I resolved the problem by adding £££ tags around text to be bolded in vertaim blocks and applying a python script to the html to find pairs of £££ and replace them with and . If anyone is interested I put a primer here:

    http://www.obriain.com/primers/txt2tags_vertaim_bold.php

    Comment by Diarmuid O'Briain — December 22, 2016 @ 5:24 am

    • I see that you already came up with a solution. In case you’re still interested in a txt2tags solution, the best I was able to come up with was using post-processing rules. I’m not very good at writing those, so my approach is a bit awkward compared to what someone else might come up with. I did it by putting these two rules into the configuration area:

      %!postproc: "/£££" "</B>"
      %!postproc: "£££" "<B>"

      Then you can use £££ and /£££ to surround the text that should be bold. It wouldn’t be quite as pretty as yours because of that added slash, but it would work, and you could use it on any verbatim text.

      Note that the order of those two rules is very important because txt2tags reads them from the top down, and if you reverse them, everything will be bold.

      Comment by mostlylinux — December 22, 2016 @ 9:30 am


RSS feed for comments on this post. TrackBack URI

Leave a reply to mostlylinux Cancel reply

Blog at WordPress.com.