txt2tags Cheat Sheet
Table of Contents
- Introduction
- Before you begin
- Header Area
- Configuration Area
- Background color
- Comments
- CSS
- Encoding
- Options
- Pre-processed plain links
- Pre-processed named links
- Pre-processed replacement text
- Table of Contents
- Target file type
- Body Area
- Anchor
- Block – comment
- Block – raw
- Block – tagged
- Block – verbatim
- Centered line of text
- Centered paragraph (method 1)
- Centered paragraph (method 2)
- Colored text
- Date
- Headings – numbered
- Headings – plain
- Horizontal rule (separator) – thin
- Horizontal rule (separator) – thick
- HTML elements (tags)
- Image
- Image alignment
- Image alignment with text
- Images connected together
- Images mixed with text
- Include CSV file
- Include HTML file
- Include text file as raw block
- Include text file verbatim
- Include txt2tags file
- Inline – bold
- Inline – italic
- Inline – mixed
- Inline – monospaced
- Inline – plain
- Inline – raw
- Inline – strike-through
- Inline – tagged
- Inline – underlined
- Inline – verbatim
- Line break
- Line – comment
- Line – raw
- Line – tagged
- Line – verbatim
- Link – anchor
- Link – email
- Link – image
- Link – labeled
- Link – plain
- List – bulleted
- List – definition
- List – numbered
- List – mixed
- Macros
- Non-breaking space
- Quotes
- Symbols – copyright © registered ® trademark ™
- Table
- Table alignment
- Table cell alignment
- Table column spans
- Table heading
- Table heading alignment
- Table mixed alignment
- Table of Contents placement
- Create the target file or change it if it already exists
- Try txt2tags online
- Obligatory happy ending
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 |
---|
|
Configuration Area |
|
Body Area |
|
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.
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:
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 |
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. |
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 |
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
|
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:
|
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:
|
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:
|
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 |
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 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:
Put this in the Body Area: | center [txt2tagsimage.png] aligned To create this:
Put this in the Body Area: | right aligned [txt2tagsimage.png] To create this:
|
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 |
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:
|
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
|
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 SampleThis 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. |
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 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 |
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. |
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:
|
Macros |
---|
Macros are shortcuts that can insert dynamic contents in the Body Area of your document. The available macros are:
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 code as inline tagged text, by surrounding it with two apostrophes (') on each side. Put this in the Body Area: TEST'' ''TEST TEST'' ''TEST TEST'' ''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): ## Put this in the Body Area: TEST##TEST TEST######TEST TEST##########TEST To create this: TEST TEST TEST TEST TEST TEST |
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: ''©'' To create this: © Put this into the Body Area: ''®'' 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\) © Put this into the Body Area: (C) To create this: © Put this into the Configuration Area: %!postproc(html): \(R\) ® 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 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:
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:
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:
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:
|
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:
|
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:
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:
|
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:
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:
|
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:
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 | | '' '' | XXXXXXXXXX | | XXXXXXXXXX | XXXXXXXXXX | | XXXXXXXXXX | '' '' | | XXXXXXXXXX | XXXXXXXXXX | | XXXXXXXXXX || | XXXXXXXXXX | XXXXXXXXXX | To create this:
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:
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:
|
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
-
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:
-
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 your terminal window is open in a different directory than the source file:
-
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
-
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:
-
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
-
If your terminal window is open in a different directory than the source file:
-
If you’ve specified a target file type in the Configuration area of your document:
-
To use the txt2tags graphical user interface (GUI):
-
Open the GUI:
-
From a shortcut:
- Create a shortcut with txt2tags –gui as the command.
- Click the shortcut from then on to launch the txt2tags GUI interface.
-
From a terminal window:
- Open a terminal window.
- Type txt2tags –gui into the terminal window and press the Enter key to launch the txt2tags GUI interface.
-
From a shortcut:
- Click the Browse button.
- Browse to the source (.t2t) file.
- Click the Open button.
- Click the drop-down to choose the target document type.
- Click in any of the optional option boxes to choose them.
- Click the Convert! button.
-
Open the GUI:
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.
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
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
I’m happy to be of service. :)
Comment by mostlylinux — November 16, 2009 @ 2:27 pm
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
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
[…] 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
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
[…] 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
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:
And then putting this in the body of the page:
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 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
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
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:
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