Author's Guide

Contact

Markdown Hosing - Register Now!

Home > Markdown Authoring > Author's Guide | Japanese

PREPRO - Markdown Preprocessors - Author's Guide

The PREPRO is a collective name for a set of preprocessors used to add values to Markdown-based authoring and publishing.

A preprocessor reads Markdown (or other WikiText) souce text mixed with special markings and produces an HTML (or PDF) output with a help of Markdown converter such as pandoc.

Markdown Preprocessor ... Preprocessor Converter HTML Inline SVG not supported by your browser

For example, Selector preprocessor can select text written in a specified language and/or specific version. Style inserts HTML DIV element with a specified stylesheet class name. The preprocessors are concatenated to form a pipeline of processes.

List of Preprecessors

The table below shows the currently available list of preprocessors. Follow the link for each preprocessor for its documentation. However before doing so, read the rest of this page which describes basic idea common to all or most preprocessors.

Preprocessor File Description Link
File Loader Include.pm Loads one or more local files or remote web content into a source file Detail
Passage Selector Selector.pm Used for writing articles in more than one language or version at the same time in the same file Detail
Style Marker Style.pm Adds an HTML DIV element with a specified stylesheet class name Detail
HereDoc Emulator HereDoc.pm Allows you to insert a value of an environment variable in the source
Simple SVG Chart Generator Draw.pm Embeds a small inline SVG chart using a simple text instruction Detail
Live Data Embedder Embedder.pm Inserts database data into a dynamically generated page Detail
General-Purpose Parser Parser.pm Concatenates preprocessors with pipes

Block and Span

The preprocessor works in one of two ways. A block level or passage preprocessor works for one or more lines at a time. A span level or inline preprocessor works for words in a line.

Look at an example Markdown source:

 # Example

 /ja/
 現在日時: $(.datetime)  
 フォロワー数: $(followers)
 /en/
 The number of your followers is $(followers) as of $(.datetime).
 /end/

/en/, /ja/ and /end/ are called block-level or passage markers. These are processed by Selector which selects lines written for a specified language.

$(followers) and $(.datetime) are called display macros (one of several types of macros) and handled by a span-level or inline preprocessor, in this case, Embedder.

After Selector and Embedder preprocesses the example source, the Markdown output will be:

If you select Japanese:

現在日時: Thu 08 Oct 2020 02:56:58 PM JST  
フォロワー数: 11

If you select English:

The number of your followers is 11 as of Thu 08 Oct 2020 02:56:58 PM JST.

Additional Information

Changes

New tools added (2020-oct-08)

Changes in marker placement rules (2020-aug-31)

Design changes in second dedition (2020-Jul-21)

Tools published (2020-Apr-17)

Presented by Kobu.Com

2020-apr-08 first edition
2020-apr-20 second edition
2020-aug-31 changes in marker placement rules
2020-oct-08 third edition

Contact