Skip to content

JoyHak/MarkdownToBBCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

When I was writing changelogs for my QuickSwitch project, I needed to convert them from Markdown markup language to BBcode markup language for posting on forums.

That is how this converter was developed. It was successfully tested on the latest complex changelog.

Here's the list of key features:

  • Full support for GitHub markdown syntax (basic and advanced).
  • Support for html tags and spoilers.
  • Delete comments, mark text that does not need to be converted.
  • Recursive block elements conversion (lists containing lists, basic syntax containing basic syntax, etc).
  • Support for any type of list (ordered, unordered, with any prefix and nesting level).
  • Attaching / detaching markdown list items from BBcode lists (ability to add or detach quotes and other items from the converted list).
  • Support for multi-level quotes with the ability to include lists, mentions, and other syntax.
  • Support for Github issues, commits and relative to the selected repository root links.
  • Restore text to its pre-conversion state for editing.
  • Convert, copy, and clear with a single click.
  • Convert file and save result to the new / existing file.
  • Command line interface (CLI) for converting different files and combining their contents into a single file.

It uses the Maple Mono font for GUI elements. If something is not working for you, please let me know. If you think that app can be improved, write to me.

Markdown

The converter supports basic syntax, complex blocks, and tables. For example, the tables with examples below can also be converted to BBcode tables (without alignment).

Basic syntax
$\texttt{\color{#fb7237}**\color{White}Bold\color{#fb7237}**\hspace{3mm}\_\_\color{White}Bold\color{#fb7237}\_\_}$ $\texttt{\color{#fb7237}[b]\color{White}Bold\color{#fb7237}[/b]}$
$\texttt{\color{#fb7237}*\color{White}Italic\color{#fb7237}*\hspace{3mm}\_\color{White}Italic\color{#fb7237}\_}$ $\texttt{\color{#fb7237}[i]\color{White}Italic\color{#fb7237}[/i]}$
$\color{#fb7237}\sim\texttt{\color{White}Strike}\color{#fb7237}\sim\hspace{3mm}\sim\sim\texttt{\color{White}Strike}\color{#fb7237 }\color{#fb7237}\sim\sim$ $\texttt{\color{#fb7237}[strike]\color{White}Strike\color{#fb7237}[/strike]}$
$\texttt{\color{#fb7237}***\color{White}Bold and italic\color{#fb7237}***\hspace{3mm}\_\_\_\color{White}Bold and italic\color{#fb7237}\_\_\_}$ $\texttt{\color{#fb7237}[b]\color{#48a5d7}[i]\color{White}Bold and italic\color{#48a5d7}[/i]\color{#fb7237}[/b]}$
$\large\color{#fb7237}\textasciiacute$ $\texttt{\color{White}Inline}\color{#fb7237}$ $\large\color{#fb7237}\textasciiacute$ $\texttt{\color{#fb7237}[c]\color{White}Inline\color{#fb7237}[/c]}$
$\large\texttt{\color{#fb7237}\#}$ h1 $\texttt{\color{#fb7237}[size=200]\color{White}h1\color{#fb7237}[/size]}$
$\large\texttt{\color{#fb7237}\#\#}$ h2 $\texttt{\color{#fb7237}[size=180]\color{White}h2\color{#fb7237}[/size]}$
$\texttt{\color{#fb7237}\#\#\#}$ h3 $\texttt{\color{#fb7237}[size=150]\color{White}h3\color{#fb7237}[/size]}$
$\tiny\texttt{\color{#fb7237}\#\#\#\#}$ h4 $\texttt{\color{#fb7237}[size=125]\color{White}h4\color{#fb7237}[/size]}$
Links
[Short name](link) $\texttt{\color{#fb7237}[url=link]\color{White}Short name\color{#fb7237}[/url]}$
![Image name](link) $\texttt{\color{#fb7237}[url]\color{White}link\color{#fb7237}[/url]}$

Html tags
$\texttt{\color{#0d529d}<sub>\color{White}Subscript\color{#0d529d}</sub>}$ $\texttt{\color{#fb7237}[size=85]\color{White}Subscript\color{#fb7237}[/size]}$
$\texttt{\color{#0d529d}<ins>\color{White}Underlined\color{#0d529d}</ins>}$ $\texttt{\color{#fb7237}[u]\color{White}Underlined\color{#fb7237}[/u]}$
$\texttt{\color{#0d529d}<details>\color{White} Text that should be hidden \color{#0d529d}</details>}$ $\texttt{\color{#0d529d}[spoiler]}$
$\texttt{\color{White}Text that should be hidden}$
$\texttt{\color{#0d529d}[/spoiler]}$
$\texttt{\color{#0d529d}<details>\color{#108c9a}}$
$\texttt{\color{#108c9a}<summary>\color{White}Examples\color{#108c9a}</summary>}$
$\texttt{\color{White}Hidden example}$
$\texttt{\color{#0d529d}</details>}$
$\texttt{\color{#0d529d}[spoiler2=Examples]}$
$\texttt{\color{White}Hidden example}$
$\texttt{\color{#0d529d}[/spoiler]}$
$\texttt{\color{#0d529d}<unknown>\color{White}Simple text\color{#0d529d}</unknown>}$ $\texttt{\color{#fb7237}[size=110]\color{White}unknown\color{#fb7237}[/size]}$
Simple text

Tags <details> on GitHub are similar to spoilers: they turn into collapsed text. The <summary> tag replaces the spoiler title "details" with the specified title.

Unknown tags are converted to headers. All converted spoilers and unknown tags will have an additional line break for readability.

Spoilers and comments
$\texttt{\color{#5e5e5e}&lt;!-- spoiler --&gt;\color{White} Text that should be hidden \color{#5e5e5e}&lt;!-- /spoiler --&gt;}$ $\texttt{\color{#fb7237}[spoiler]}$
$\texttt{\color{White}Text that should be hidden}$
$\texttt{\color{#fb7237}[/spoiler]}$
$\texttt{\color{#5e5e5e}&lt;!-- alternate --&gt;\color{White} Text that shouldn't be converted \color{#5e5e5e}&lt;!-- /alternate --&gt;}$ Text that shouldn't be converted
$\texttt{\color{#5e5e5e}&lt;!--\color{White} Text that should be removed \color{#5e5e5e}--&gt;}$

Line breaks
$\texttt{\color{#0d529d}&lt;br&gt; &lt;/br&gt; &lt;br/&gt; }$
Line with trailing slash\
New line
Line with trailing slash

New line
Line with 2 trailing spaces
NewLine
Line with 2 trailing spaces

NewLine

Line breaks affect the final appearance of BBcode lists and quotes, but do not affect the appearance of tables: a Markdown table can contain line breaks and they will be captured by the BBcode table. A Markdown list or quote can contain line breaks, but they may not be included in the BBcode list or quote (see detailed examples below).

Spaces between markup and words are optional, as well as spaces inside and outside tags and comments. It means that ** Bold ** and **Bold** or <!-- alternate --> and <!--alternate--> are treated the same.

Blocks

The blocks below are converted into opening and closing BBcode tags, split into several lines for readability (otherwise everything will turn into a horrible mess). Empty lines, spaces, and tabs between tags do not affect the rendered BBcode.

To reduce the demonsration, some tags are on the single line.

Code
$\color{#fb7237}\textasciiacute\textasciiacute\textasciiacute\color{#fa4738}py$
$\texttt{print(\color{#48ee44}"hello!"}$)
$\color{#fb7237}\textasciiacute\textasciiacute\textasciiacute$
$\texttt{\color{#fb7237}[code]}$
$\texttt{\color{White}print(\color{#48ee44}"hello!"}$)
$\texttt{\color{#fb7237}[/code]}$
$\color{#fb7237}\textasciiacute\textasciiacute\textasciiacute$
$\texttt{MsgBox(\color{#48ee44}"hello!"}$)
$\color{#fb7237}\textasciiacute\textasciiacute\textasciiacute$
$\texttt{\color{#fb7237}[code]}$
$\texttt{\color{White}MsgBox(\color{#48ee44}"hello!"}$)
$\texttt{\color{#fb7237}[/code]}$

Block quotes
$\texttt{\color{#48a5d7}&gt;}$ A quote looks like a block
$\texttt{\color{#48a5d7}&gt;}$ of text
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{White}A quote looks like a block}$
$\texttt{\color{White}of text}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{#48a5d7}&gt; \color{#fb7237}[!NOTE] [!Tip] [!warning] [!cAuTiOn]}$
$\texttt{\color{#48a5d7}&gt;}$ But this is alert
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{#fb7237}[b]NOTE[/b] [b]Tip[/b] [b]warning[/b] [b]cAuTiOn[/b]}$
$\texttt{\color{White} But this is alert}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{#48a5d7}&gt;}$ Quotes can contain
$\texttt{\color{#48a5d7}&gt; &gt;}$ nested quotes
$\texttt{\color{#48a5d7}&gt;}$ without spaces between prefix and word
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{White} Quotes can contain}$
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{White} nested quotes}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{White}without spaces between prefix and word}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{#48a5d7}&gt;}$ Many
$\texttt{\color{#48a5d7}&gt; &gt;}$ many
$\texttt{\color{#48a5d7}&gt; &gt; &gt;}$ nested
$\texttt{\color{#48a5d7}&gt;}$ quotes
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{White}Many}$
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{White}many}$
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{White}nested}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{White}quotes}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{#48a5d7}&gt;}$ As well as:
$\texttt{\color{#48a5d7}&gt; \color{#006868} 1.}$ Ordered lists
$\texttt{\color{#48a5d7}&gt;\hspace{1cm}\color{#006868}1.}$ item1
$\texttt{\color{#48a5d7}&gt;\hspace{1cm}\color{#006868}2.}$ item2
$\texttt{\color{#48a5d7}&gt; \color{#0d529d}&lt;sub&gt;\color{White}tags\color{#0d529d}&lt;/sub&gt;,}$
$\texttt{\color{#48a5d7}&gt;}$ $\texttt{\color{#717171}&lt;!-- \color{White}comments \color{#5e5e5e}--&gt;,}$
$\texttt{\color{#48a5d7}&gt; \color{#fb7237}*\color{White}basic syntax\color{#fb7237}*}$
$\texttt{\color{#48a5d7}&gt;}$ and many more…
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{White} As well as:}$
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ Ordered lists $\texttt{}$
$\texttt{\color{#11975a}[list=1]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ item1 $\texttt{}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ item2 $\texttt{}$
$\texttt{\color{#11975a}[/list][/list]}$
$\texttt{\color{#fb7237}[size=85]\color{White}tags\color{#fb7237}[/size],}$
$\texttt{\color{#fb7237}[i]\color{White}basic syntax\color{#fb7237}[/i]}$
$\texttt{\color{White}and many more…}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{#48a5d7}&gt; \color{#006868} 1.}$ Lists can have an infinite level of nesting
$\texttt{\color{#48a5d7}&gt;\hspace{1cm}\color{#006868}1.}$ item1
$\texttt{\color{#48a5d7}&gt;\hspace{2cm}\color{#006868}2.}$ item2
$\texttt{\color{#48a5d7}&gt;\hspace{3cm}\color{#006868}3.}$ item3
$\texttt{\color{#48a5d7}&gt; \color{#006868} -}$ And unordered lists can be nested too!
$\texttt{\color{#48a5d7}&gt;\hspace{1cm}\color{#006868}-}$ Item
$\texttt{\color{#48a5d7}&gt;\hspace{2cm}\color{#006868}-}$ deep item
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{#11975a}[list=1]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ Lists can have an infinite level of nesting $\texttt{}$
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ item1 $\texttt{}$
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ item2 $\texttt{}$
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ item3 $\texttt{}$
$\texttt{\color{#11975a}[/list][/list][/list][/list]}$
$\texttt{}$
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ And unordered lists can be nested too! $\texttt{}$
$\texttt{\color{#11975a}[list]\color{#006868}[*] }$ Item $\texttt{}$
$\texttt{\color{#11975a}[list]\color{#006868}[*] }$ deep item $\texttt{}$
$\texttt{\color{#11975a}[/list][/list][/list]}$
$\texttt{}$
$\texttt{\color{White}Lists can be mixed}$
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ item1 $\texttt{}$
$\texttt{\color{#11975a}[list]\color{#006868}[*] }$ item2 $\texttt{}$
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ item3 $\texttt{}$
$\texttt{\color{#11975a}[/list][/list][/list]}$
$\texttt{\color{#fb7237}\color{#48a5d7}[/quote]}$
$\texttt{\color{#48a5d7}&gt;}$ Lists can be mixed
$\texttt{\color{#48a5d7}&gt; \color{#006868} 1.}$ item1
$\texttt{\color{#48a5d7}&gt; \color{#006868} -}$ item2
$\texttt{\color{#48a5d7}&gt; \color{#006868} 3.}$ item3
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{White} Lists can be mixed}$
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ item1 $\texttt{}$
$\texttt{\color{#11975a}[list]\color{#006868}[*] }$ item2 $\texttt{}$
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ item3 $\texttt{}$
$\texttt{\color{#11975a}[/list][/list][/list]}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{#48a5d7}&gt;}$ $\texttt{\color{#006868} -}$ As you might guess,
$\texttt{\color{#48a5d7}&gt;}$ $\texttt{\color{#006868} -}$ all of this applies to:
$\texttt{\color{#48a5d7}&gt;\hspace{1cm}\color{#006868}1.}$ lists in quotes.
$\texttt{\color{#48a5d7}&gt;\hspace{1cm}\color{#006868}2.}$ lists outside quotes.
$\texttt{\color{#48a5d7}&gt;\hspace{1cm}\color{#006868}3.}$ lists with different levels of nesting.
$\texttt{\color{#48a5d7}&gt; \color{#006868} -}$ As well as applied to ordered / unordered lists mixing.
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ As you might guess, $\texttt{}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ all of this applies to: $\texttt{}$
$\texttt{\color{#11975a}[list=1]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ lists in quotes. $\texttt{}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ lists outside quotes. $\texttt{}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ lists with different levels of nesting. $\texttt{}$
$\texttt{\color{#11975a}[/list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ As well as applied to ordered / unordered lists mixing. $\texttt{}$
$\texttt{\color{#11975a}[/list]}$
$\texttt{\color{#48a5d7}[/quote]}$

Lists
$\texttt{\color{#006868} -}$ The list can start with any number of tabs and spaces
$\texttt{\hspace{1cm}\color{#006868} -}$ Each subsequent item in the list should start with the same number of tabs and spaces!
$\texttt{\hspace{2cm}\color{#006868} -}$ Nesting levels are taken into account in both spaces and tabs (converted to 8 spaces).
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#006868}[*] }$ The list can start with any number of tabs and spaces
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#006868}[*] }$ Each subsequent item in the list should start with the same number of tabs and spaces! $\texttt{}$
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ Nesting levels are taken into account in both spaces and tabs (converted to 8 spaces). $\texttt{}$
$\texttt{\color{#11975a}[/list][/list]\color{#11975a}[/list]}$
$\texttt{\color{#006868} 1.}$ Lists can have an infinite level of nesting
$\texttt{\hspace{1cm}\color{#006868}1.}$ item1
$\texttt{\hspace{2cm}\color{#006868}2.}$ item2
$\texttt{\hspace{3cm}\color{#006868}3.}$ item3
$\texttt{\color{#11975a}[list=1]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ Lists can have an infinite level of nesting
$\texttt{\color{#11975a}[list=1]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ item1
$\texttt{\color{#11975a}[list=1]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ item2
$\texttt{\color{#11975a}[list=1]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ item3
$\texttt{\color{#11975a}[/list]}$
$\texttt{\color{#11975a}[/list][/list]\color{#11975a}[/list]}$
$\huge{\textsf{\color{#006868} *}}$ List items can have any prefix
$\textsf{\hspace{1cm}\color{#006868}+}$ item
$\huge{\textsf{\hspace{2cm}\color{#006868}-}}$ item
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ List items can have any prefix
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#006868}[*] }$ item
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#006868}[*] }$ item
$\texttt{\color{#11975a}[/list][/list][/list]}$
$\texttt{\color{#006868} -}$ Lists can be mixed
$\texttt{\color{#006868}1.}$ item describes:
$\texttt{\hspace{1cm}\color{#006868}-}$ item1
$\texttt{\hspace{1cm}\color{#006868}-}$ item2
$\texttt{\color{#006868}2.}$ This item continues previous list started at 1.
$\texttt{\color{#11975a}[list]\color{White}\color{#006868}[*] }$ Lists can be mixed[/list]
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ item describes:
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ item1
$\texttt{\color{#fb7237}\color{#006868}[*] }$ item2
$\texttt{\color{#11975a}[/list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ This item continues previous list started at 1.
$\texttt{\color{#11975a}[/list]}$
$\texttt{\color{#006868} 1.}$ The lists go on and on.
$\texttt{\color{#006868}2.}$ This element is part of the list started in point 1.
$\texttt{\color{#006868}-}$ To start a new list at the same nesting level,
$\texttt{\color{#006868}-}$ start a list of a different type.
$\texttt{\hspace{1cm}\color{#006868}-}$ Or increase the nesting level.
$\texttt{\color{#11975a}[list=1]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ The lists go on and on.
$\texttt{\color{#fb7237}\color{#006868}[*] }$ This element is part of the list started in point 1.
$\texttt{\color{#11975a}[/list][list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ To start a new list at the same nesting level,
$\texttt{\color{#fb7237}\color{#006868}[*] }$ start a list of a different type.
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ Or increase the nesting level.
$\texttt{\color{#11975a}[/list]\color{#11975a}[/list]}$
$\texttt{\color{#006868} -}$ List can capture additional text elements, as well as quotes, spoilers, $\texttt{\color{#fb7237}**\color{White}all supported syntax\color{#fb7237}**}$ .
$\texttt{\color{#006868}-}$ Add a tab or space before the item to add it to the list.
$\texttt{\hspace{3mm}\color{#48a5d7}&gt;}$ This quote belongs to the 1st item.
$\texttt{\color{#48a5d7}&gt;}$ This quote does not belong to the list.
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ List can capture additional text elements, as well as quotes, spoilers, $\texttt{\color{#fb7237}[b]\color{White}all supported syntax\color{#fb7237}[/b]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ Add a tab or space before the item to add it to the list.
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{White} This quote belongs to the 1st item}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{#11975a}[/list]}$
$\texttt{\color{#48a5d7}[quote]}$
$\texttt{\color{White} This quote does not belong to the list.}$
$\texttt{\color{#48a5d7}[/quote]}$
$\texttt{\color{#006868} -}$ Quotes and other elements are belongs to previous item regardless of its nesting level.
$\texttt{\color{#006868} 1.}$ Item1
$\texttt{\hspace{1cm}\color{#006868} 2.}$ Item2
$\texttt{\hspace{1cm}\color{#48a5d7}&gt;}$ This quote belongs to item2.
$\texttt{\hspace{2cm}\color{#006868} 3.}$ Item3
$\texttt{\hspace{2cm}\color{#48a5d7}&gt;}$ This quote belongs to item3.
$\texttt{\hspace{2cm}\color{#006868}4.}$ Item4
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#006868}[*] }$ Quotes and other elements are belongs to previous item regardless of its nesting level.
$\texttt{\color{#11975a}[/list]}$
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ Item1
$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ Item2
$\texttt{\color{#48a5d7}[quote]\color{White}This quote belongs to item2.\color{#48a5d7}[/quote]}$

$\texttt{\color{#11975a}[list=1]\color{#006868}[*] }$ Item3
$\texttt{\color{#48a5d7}[quote]\color{White}This quote belongs to item3.\color{#48a5d7}[/quote]}$

$\texttt{\color{#fb7237}\color{#006868}[*] }$ Item4
$\texttt{\color{#11975a}[/list][/list]\color{#11975a}[/list]}$
$\texttt{\color{#006868} -}$ To separate any item / quote / other from the list (or start a new list), dont' add space before the item / quote;
$\texttt{\color{#006868}-}$ or leave one or more blank lines between the item and the list.
$\texttt{\color{#48a5d7}&gt;}$ No spaces: this quote does not belong to the list.

$\texttt{\color{#48a5d7}&gt;}$ Another line: this quote does not belong to the list.
$\texttt{\color{#11975a}[list]}$
$\texttt{\color{#fb7237}\color{#006868}[*] }$ To separate any item / quote / other from the list (or start a new list), dont' add space before the item / quote;
$\texttt{\color{#fb7237}\color{#006868}[*] }$ or leave one or more blank lines between the item and the list.
$\texttt{\color{#11975a}[/list]}$
$\texttt{\color{#48a5d7}[quote]\color{White}No spaces: this quote does not belong to the list.\color{#48a5d7}[/quote]}$

$\texttt{\color{#48a5d7}[quote]\color{White}Another line: this quote does not belong to the list.\color{#48a5d7}[/quote]}$
$\texttt{\color{#006868} -}$ Use line break characters $\texttt{\color{#0d529d}\\ &lt;/br&gt; &lt;br&gt;}$
$\texttt{\color{#48a5d7}&gt;}$ This quote does not belong to the list.
$\texttt{\color{#11975a}[list]\color{White}\color{#006868}[*]\color{White} Use line break characters\color{#11975a}[/list]}$

$\texttt{\color{#48a5d7}[quote]\color{White}This quote does not belong to the list.\color{#48a5d7}[/quote]}$

GitHub links and references

Links and images can be relative to the repository root (it usually starts with /). You can specify the repository in the converter settings. All relative links will be appended into the repository URL. You can use all relative link operands, such as ./ or ../. Relative link text should be on a single line.

The correctness of the converted link is not checked for performance reasons. Make sure that after adding the repository into the relative link, it is correct.

Relative links
[Relative readme](./README.md) $\texttt{\color{#fb7237}[url=}$ https://redirect.github.com/JoyHak/QuickSwitch/README.md $\texttt{\color{#fb7237}]\color{White}Relative readme\color{#fb7237}[/url]}$
$\texttt{\color{#7ab3dc}![\color{White}Image name\color{#7ab3dc}](}$ https://myoctocat.com/assets/images/base-octocat.svg $\texttt{\color{#7ab3dc})}$ $\texttt{\color{#fb7237}[url]}$ https://myoctocat.com/assets/images/base-octocat.svg $\texttt{\color{#fb7237}[/url]}$
$\texttt{\color{#7ab3dc}@\color{White}JoyHak}$ $\texttt{\color{#fb7237}[url=}$ https://redirect.github.com/JoyHak $\texttt{\color{#fb7237}]\color{#7ab3dc}@\color{White}JoyHak\color{#fb7237}[/url]}$

All issues and commits in short form will be appended into the repository URL. The converter cannot check whether #64 is a Pull Request (PR), discussion, or issue, so it always assumes that it is an issue.

Issues (PRs is not supported)
$\texttt{\color{#7ab3dc}\#\color{#7a80dc}64}$ $\texttt{\color{#fb7237}[url=}$ https://redirect.github.com/JoyHak/QuickSwitch/issues/64 $\texttt{\color{#fb7237}]\color{#7ab3dc}\#\color{#7a80dc}64\color{#fb7237}[/url]}$
$\texttt{\color{White}GH-\color{#7a80dc}64}$ $\texttt{\color{#fb7237}[url=}$ https://redirect.github.com/JoyHak/QuickSwitch/issues/64 $\texttt{\color{#fb7237}]\color{White}GH-\color{#7a80dc}64\color{#fb7237}[/url]}$
$\texttt{\color{White}JoyHak\color{#7ab3dc}/\color{White}QuickSwitch\color{#7ab3dc}\#\color{#7a80dc}64}$ $\texttt{\color{#fb7237}[url=}$ https://redirect.github.com/JoyHak/QuickSwitch/issues/64 $\texttt{\color{#fb7237}]\color{White}JoyHak\color{#7ab3dc}/\color{White}QuickSwitch\color{#7ab3dc}\#\color{#7a80dc}64\color{#fb7237}[/url]}$
$\texttt{\color{White}AutoHotkey\color{#7ab3dc}/\color{White}AutoHotkeyDocs\color{#7ab3dc}\#\color{#7a80dc}744}$ $\texttt{\color{#fb7237}[url=}$ https://redirect.github.com/AutoHotkey/AutoHotkeyDocs/issues/744 $\texttt{\color{#fb7237}]\color{White}AutoHotkey\color{#7ab3dc}/\color{White}AutoHotkeyDocs\color{#7ab3dc}\#\color{#7a80dc}744\color{#fb7237}[/url]}$
Commits
896111015666c8fa7a8b390232a52e79356319c4 $\texttt{\color{#fb7237}[url=}$ https://redirect.github.com/JoyHak/QuickSwitch/commit/896111015666c8fa7a8b390232a52e79356319c4 $\texttt{\color{#fb7237}]\color{#7a80dc}8961110\color{#fb7237}[/url]}$
$\texttt{\color{White}JoyHak\color{#7ab3dc}/\color{White}QuickSwitch\color{#7ab3dc}@}$ 896111015666c8fa7a8b390232a52e79356319c4 $\texttt{\color{#fb7237}[url=}$ https://redirect.github.com/JoyHak/QuickSwitch/commit/896111015666c8fa7a8b390232a52e79356319c4 $\texttt{\color{#fb7237}]\color{White}JoyHak\color{#7ab3dc}/\color{White}QuickSwitch\color{#7ab3dc}@\color{#7a80dc}8961110\color{#fb7237}[/url]}$

Command line

The command interface allows you to convert files and any text directly from the terminal. The result can be saved to a file or printed to the terminal and passed to any command using the | pipe operator.

You can use auto-completion for CLI directly in Powershell 5.1 and above. This requires an auto-completion module, such as PSReadLine and Register-AutocompleteCommand.

Auto-completion setup

Add the path to the directory containing md2bb.exe to the path environment variable:

setx PATH "$env:path;\the\directory\to\add" -m

Then open the profile:

notepad $PROFILE

If you're using Cmder or Conemu, open %CMDER_ROOT%\config\user_profile.ps1. Add the following command:

Register-AutocompleteCommand -Commands 'md2bb'

# Set auto-complete list view
$options = @{
    PredictionSource    = 'HistoryAndPlugin'
    PredictionViewStyle = 'ListView'
}
Set-PSReadLineOption @options

# Assign an auto-complete key, such as `Tab`
Set-PSReadLineKeyHandler -Chord 'Tab' -Function 'MenuComplete'

Restart your PC. Now, after entering md2bb and pressing Tab, you will see a list of available parameters and their descriptions. When entering arguments, such as -repo, you can press Tab again to read its description. Press Tab again to have autocomplete type the parameter for you.

Usage: md2bb (<file_name> | <text> | @listfile) [<parameters> <switches>]

Parameters
-save, -write The name / path of the file where to write the result. The result will be appended at the end of the file if it already exists.
-repo, -repository, -domain Url to the repository for resolving relative links and references.
-sep, -separator, -delimiter Separator for text parameters concatenation.
Switches
-h, -help Displays help message.
-overwrite Overwrite the file where to write the result.

Parameters order doesn't matter:

    md2bb -save 'forum.md' 'readme.md'
    md2bb 'readme.md' -save 'forum.md'

Text can be combined:

    md2bb 'readme.md' 'add text' 'another text' 'license.md' -sep ' '
    md2bb 'sentence' 'will be' 'splitted' -save 'forum.md'

The value of -repo is stored on the disk, so it can be passed once. After that its value will be used for each md2bb usage:

    md2bb -repo 'https://github.com/JoyHak/MarkdownToBBCode' -> 'Repository has been saved'
    md2bb 'issue #1' -> issue [url=https://github.com/JoyHak/MarkdownToBBCode/issues/1]#1[/url]

Parameters prefix can be / - --. Parameter without prefix will be treated as file name / text / listfile to convert:

    md2bb 'readme.md' 'add text' '@listfile.md'
    Reads and converts contents of 'readme.md', then converts 'add text', then reads and converts contents of 'listfile.md' line by line.

@listfile can be @filename.ext or @path and it can contain anything. It will be readed and each line will be converted as the text. If line contains file name / path, it's contents will be converted (if it exists). Also it can be used to convert individual lines, combine them into one text and separate using symbol passed via -sep .

You can pass the | symbol as a text to force the separation of parts of the text from each other:

    md2bb 'readme.md|@listfile.md'
    Reads and converts 'readme.md' file, then reads and converts 'listfile.md' line by line.
    
    md2bb 'sentence|will be|splitted'
    Convert 'sentence' 'will be' 'splitted' separately.

Pass -sep symbol to concatenate different parts:

    md2bb 'sentence|will be|splitted'     -sep '_' -> 'sentence_will be_splitted'
    md2bb 'sentence' 'will be' 'splitted' -sep '_' -> 'sentence_will be_splitted'

    md2bb 'readme.md' 'add text' -sep '_' -save 'forum.md'
    Concatenates converted contents of 'readme.md' with 'add text' using '_' symbol and appends it to the 'forum.md'.

You can pass multi-line text and -sep value:

    md2bb ' > Multi-line            ->  [quote]Multi-line
    > text'                             text[/quote]
    
    md2bb '*New*' '*line*' -sep '   ->  [i]New[/i]
    +'                                  [i]+line[/i]

You can also pass any line break tags to get several lines of the text:

    md2bb '_New_<br>_line_'         ->  [i]New[/i]
                                        [i]line[/i]
   
    md2bb 'New<br/>line' -sep '+'   ->  [i]New[/i]
                                        [i]line[/i]
    Ignores '-sep' because text is treated as single part.

The -save parameter appends the converted text at the end of existing file, removing all leading and trailing spaces, tabs, and blank lines. This allows you to create complex conversion chains:

md2bb 'readme.md' 'add text' '@listfile.md' 'add another text' '@lines.md' -save 'forum.md'

If you want to recreate the file, use -overwrite switch:

md2bb 'readme.md' -save 'readme.md'
Appends converted contents of 'readme.md' at the end of this file.
md2bb 'readme.md' -save 'readme.md' -overwrite
Deletes 'readme.md' and appends converted content to the new 'readme.md'

To convert individual elements to different files, use separate commands:

md2bb 'readme.md' 'add text' -save 'forum.md'
md2bb 'license.md' 'add copyright' -save 'lic.md'

About

Convert text from Markdown to BBCode markup language using GUI or CLI.

Resources

License

Stars

Watchers

Forks

Packages

No packages published