Pandoc2BBCode
Pandoc2BBCode is a pandoc writer for converting to PHPBBCode from over 20 input formats (including markdown, html, ODT and docx).
It’s a useful tool for writing elegantly formatted posts on PureBASIC forums using Markdown, or to convert existing documents on the fly.
The script (Lua) was adapted to target specifically the BBCode flavour used on PB Forums. It also introduces some fancy features, like different size and color for each heading level (H1-H6), where colors where chosen based on PB Forums default color scheme.
Pandoc2BBCode has been included in the «PureBASIC Archives» project, where only the files relevant to PB Forums usage are kept:
The original 2bbcode script was created by @lilydjwg, and I have made changes to adapt it to the BBCode flavour used on PB Forums:
Typography Examples
Here are some typography examples:
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Source code examples can be easily created with <pre> or <pre><code> tags in html, or using fenced code in markdown (``` or ~~~):BlockQuotes: This is a blockquote element, either created in html with the <blockquote> tag, or in markdown with >.
Code: Select all
NewMap Country.s()
Country("US") = "United States"
Country("FR") = "France"
Country("GE") = "Germany"
ForEach Country()
Debug Country()
Next
- I’m a bullete list
- another item
- a sublist
I’m a loose paragraph within a list. Nesting elements — even block elements! — in a forum post has never been easier.
And, of course, we can also nest source code:And a list-nested blockquote to…
Code: Select all
Debug("Geee ... pandoc2bbc is really cool!")
- another item
- and so on
- a sublist
- I’m an ordered list
- another item
- a sub list
- another item
Inline formatting is also styled: bold, italic, strikethrough, inline code.
Project Status
There are still some functions unsupported/unimplemented by the script. Some of these will eventually be implemented (sooner or later), others simply can’t be implemented in BBCode (eg: tables, or other unsupported tags).
Pandoc2BBCode issues warnings on STDERR when it is suppressing some text than can’t be converted, or error messages if it encounters a formatting element for which there is no corresponding function — if you do stumble in a warning of the latter type, please open an issue on GitHub an report it (paste the error message, if possible):
This would greatly help further developement of the script.
Enjoy!
Tristano