[Script] Markdown to BBCode Converter

Post your working scripts, libraries and tools
GeekDude
Posts: 853
Joined: 02 Oct 2013, 22:13

[Script] Markdown to BBCode Converter

08 Jun 2018, 15:41

Markdown to BBCode Converter

Write your forum posts in Markdown and convert them to BBCode for display on the forum.

Very useful for publishing scripts stored on GitHub!

Image


Usage

Simply paste in your markdown code, hit the convert button, and copy out the BBCode for your forum post.

This converter offers a few special additions to Markdown to make it easier to create consistent posts.

Alternate sections:

Code: Select all

<!-- alternate
Any text in here will be put literally into the BBCode.
This is useful for adding features to your bbcode that are
not available in Markdown.
-->
Any text in here will be omitted from your BBCode. 
This is useful for adding features to your Markdown that
are not available in BBCode.
<!-- /alternate -->
Spoilers:

Code: Select all

<!-- spoiler -->
Text in here will always be visible in Markdown, but
will be wrapped in spoiler tags in the BBCode.
<!-- /spoiler -->



Releases

The latest version can always be found on the GitHub Gist page below.

https://gist.github.com/G33kDude/349c4b ... b2a9677857
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
GitHub: derz00
Location: Middle of the round cube

Re: [Script] Markdown to BBCode Converter

08 Jun 2018, 18:53

Nice! Hurray for Regex
try it and see
...
Helgef
Posts: 3924
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Script] Markdown to BBCode Converter

09 Jun 2018, 02:38

Hello

This is good stuff, thanks for sharing .

Code: Select all

### Hello

This is good *stuff*, thanks for `sharing` .
Cheers :thumbup:.
lexikos
Posts: 6592
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: [Script] Markdown to BBCode Converter

06 Sep 2018, 04:15

There are some things I use that the script doesn't seem to support: code blocks which aren't marked except by identation, and lists with indentation and -.

Code: Select all

Code follows:

    MsgBox, This is code.

List follows:
  - Item 1
  - Item 2
  
Seems odd to write * at the start of the line for list items.

It would be more convenient if it wasn't single-use (the form is locked once the conversion is performed).
User avatar
joedf
Posts: 7245
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: [Script] Markdown to BBCode Converter

02 Oct 2018, 08:21

Coolio, now you gotta add a preview button ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
GeekDude
Posts: 853
Joined: 02 Oct 2013, 22:13

Re: [Script] Markdown to BBCode Converter

04 Oct 2018, 11:58

lexikos wrote:There are some things I use that the script doesn't seem to support: code blocks which aren't marked except by identation, and lists with indentation and -.

Code: Select all

Code follows:

    MsgBox, This is code.

List follows:
  - Item 1
  - Item 2
Seems odd to write * at the start of the line for list items.
I only wrote in support for the subset of Markdown that I was using in my README files at the time, which would explain these lapses.

Supporting four-space prefixing for code blocks will also be a little tricky, though certainly doable when I have the time and inclination.

It would be a simple regular expression tweak to allow - for lists, but allowing for indentation on the first list item will take a little thought.
Using asterisk for lists is supported by GitHub markdown at least, and it makes sense when you're working with a block font that places the asterisk
along the center line. The BBCode that it converts to uses asterisk to denote list items as well so it seemed prudent to follow suit.

lexikos wrote:It would be more convenient if it wasn't single-use (the form is locked once the conversion is performed).
joedf wrote:Coolio, now you gotta add a preview button ;)
Yeah, the GUI was an afterthought; I was shooting for bare minimal functionality. The form locks after conversion
so that you don't accidentally run the converter a second time after it has already been converted to bbcode.

A better UI will be one of my priorities when I revisit this project in the future.

Thank you both for your feedback!

Return to “Scripts and Functions”

Who is online

Users browsing this forum: c600g, gwarble and 18 guests