[Script] Markdown to BBCode Converter

Post your working scripts, libraries and tools for AHK v1.1 and older
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

[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
Location: Middle of the round cube
Contact:

Re: [Script] Markdown to BBCode Converter

08 Jun 2018, 18:53

Nice! Hurray for Regex
try it and see
...
Helgef
Posts: 4709
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: 9583
Joined: 30 Sep 2013, 04:07
Contact:

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: 8953
Joined: 29 Sep 2013, 17:08
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, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

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!
pk23
Posts: 110
Joined: 24 Apr 2015, 00:49

Re: [Script] Markdown to BBCode Converter

20 Oct 2020, 21:12

Bug Report:

Markdown code:

Code: Select all

[![](https://1.com/(2))](https://1.com/(2)/3)
Expected Result:

Code: Select all

[url=https://1.com/(2)/3][img]https://1.com/(2)[/img][/url]
Actual Result:

Code: Select all

[[img]https://1.com/(2[/img]/3)
iseahound
Posts: 1444
Joined: 13 Aug 2016, 21:04
Contact:

Re: [Script] Markdown to BBCode Converter

07 Oct 2021, 18:36

@GeekDude Nice script. It doesn't work with in line code snippets, i.e. ``` the three backticks.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: KruschenZ and 153 guests