A set of custom Pandoc writers for converting to BBCode.
- System Requirements
- Linux Usage
- Windows Usage
- Pandoc Setup
2bbcode is a project hosting custom pandoc writers, written in Lua, which allow to convert to BBCode any input format supported by pandoc.
Since pandoc ships with a built-in Lua interpreter, using 2bbcode wrtiers doesn’t require installing Lua on the system.
There are currently two 2bbcode writers in this project, addressing different BBCode flavors:
2bbcode.lua– the original 2bbcode writer by @lilydjwg, targeting the BBCode used by FluxBB.
bbcode_phpbb.lua– a fork of
2bbcode.luaby @tajmone, targeting the BBCode used by phpBB.
Pandoc is a cross-platform FOSS command line tool for converting documents from one format to another. It natively supports more than 20 input formats and over 40 output formats, and can be extended to work with custom input (reader) and outupt (writer) formats through external scripts – likes the custom BBCode writers in this project.
Pandoc is written in Haskell, and precompiled binary releases for Windows, Mac OS X and Linux are available for download.
- BBCode manual at PHP.net
- BBCode.org (website dedicate to BBCode resources)
- phpBB’s BBCode guide
- BBCode entry at Wikipedia
BBCode (Bulletin Board Code) is a lightweight markup language used by many message boards to format posts. From Wikipedia:
BBCode was introduced in 1998 by the messageboard software Ultimate Bulletin Board (UBB) implemented in Perl. In 2000 BBCode was used in phpBB – an internet forum system written in PHP. vBulletin also uses BBCode.
BBCode tags work in a similar way to HTML tags, but square brackets are employed instead of angle brackets, and no paragraph tag is needed:
Here comes a [b]bold word[/d].
BBCode has fewer tags than HTML, intended to cover simple formatting cases.
Since different implementations of BBCode employ different subsets of tags, there are different flavors of BBCode, and while the most common tags should work across all BBCode implementations, advanced formatting tags might not.
For more information, see Pandoc Setup.
Required 2bbcode Linux files:
./2bbcode -f FORMAT <input >output
FORMAT defaults to
pandoc --list-input-formats to list acceptable formats.
Required 2bbcode_phpbb Linux files:
./2bbcode_phpbb -f FORMAT <input >output
Same as with 2bbcode, except for scripts names.
If you want to use 2bbcode globally, put all the required
*.bat files in a same folder which is on the system
Required 2bbcode Windows files:
2bbcode.batvia command line:
Pandoc will guess input format from input file’s extension. This batch script allows conversion from any pandoc supported input format. For markdown input files, it will default to pandoc’s extended Markdown.
gfm2bbcode.batvia command line:
This will convert the GitHub-Flavored (no hard-linebreaks) input markdown file to
filename.bbcode. This batch script invokes pandoc with the following settings:
--smart --wrap=none --normalize -f markdown_github-hard_line_breaks
… which is most likely what you’re looking for when working with GitHub related markdown files.
gfm2bbcode.batfrom Windows File Explorer:
Just drag’n’drop input file over
gfm2bbcode.bat, a converted
*.bbcodefile will be created in the same folder as input file.
Required 2bbcode_phpbb Windows files:
Use is the same as with 2bbcode, except for scripts names.
You have different choices for setting up pandoc:
The advised choice is #2 – install via Chocolatey!
Pandoc MSI Installer
Pandoc for Windows ships with an msi installer.
When asked, choose “install pandoc for current user” (best choice).
Pandoc via Chocolatey
- Pandoc package at Chocolatey.org
Chocolatey handles silent installation and updates in the background (using default options), and helps you keeping pandoc always updated to the latest release.
If you prefer to use pandoc in standalone mode, you’ll need to extract pandoc binary executable from the installer file – for some reasons, the standalone version is no longer available for download. The installer contains two binary files (
pandoc-citeproc.exe), the html User’s Guide and the license files.
- Dowload the pandoc msi installer (eg:
- Unpack it (using 7-Zip) and extract and rename the
- Optionally (if you need to use CiteProc for working with citations and bibliography files) also extract
pandoc_citeprocEXEand rename it to
Make sure that
pandoc.exe (and, eventually,
pandoc_citeproc.exe) is reachable via
%PATH%, or just put it in the same folder as the
2bbcode.lua script and the documents you want to convert (this is a good solution if you want to keep all your work within one folder).
Pandoc Supported Input Formats
As of pandoc v1.19, the supported input formats are:
commonmark– CommonMark Markdown.
docx– Word docx.
haddock– Haddock markup.
json– JSON version of native AST.
markdown– pandoc’s extended Markdown.
markdown_github– GitHub-Flavored Markdown.
markdown_phpextra– PHP Markdown Extra.
markdown_strict– original unextended Markdown.
mediawiki– MediaWiki markup.
native– native Haskell.
odt– ODT (Open Document Format for Office Applications).
opml– OPML (Outline Processor Markup Language).
org– Emacs Org mode.
textile– (subsets of) Textile.
twiki– TWiki markup.
You can view a list of all input formats supported in pandoc by typing: