Sand
He/Him
Editor, Player (148)
Joined: 6/26/2018
Posts: 223
The TASVideos forum uses a markup format based on BBCode. Pandoc is a program that can convert between many different markup formats. This is a custom writer for Pandoc that lets you convert from any of Pandoc’s input formats to TASVideos forum markup. Usage Install Pandoc and download tasvideos_forum.lua. Run pandoc with the -f option ("from") set to the format you are converting from, and the -t option ("to") set to the path to tasvideos_forum.lua. See the documentation on custom readers and writers. Say your input is in Markdown format in the file input.md. Then you would run:
pandoc -f markdown -t tasvideos_forum.lua input.md
If the input format is obvious from the filename extension, you can omit the -f option:
pandoc -t tasvideos_forum.lua input.md
pandoc -t tasvideos_forum.lua input.html
pandoc -t tasvideos_forum.lua input.docx
To save the output to a file, use the -o option:
pandoc -t tasvideos_forum.lua -o output.bbcode input.md
Example The custom writer can be useful when you have some input whose representation as BBCode is difficult (such as complicated tables), if you already have text written in some other format, or if you’re just more comfortable to writing in another format such as HTML or Markdown. Take this Markdown input:
![Small Mario](https://tasvideos.org/favicon.ico)

- *Lots* of lag reduction
- New shortcut

|World      |Frames saved|
|-----------|-----------:|
|Grass Land |          14|
|Desert Land|           2|
The command pandoc -t tasvideos_forum.lua input.md converts it to:
[img]https://tasvideos.org/favicon.ico[/img]
[b]Small Mario[/b]

[list]
[*][i]Lots[/i] of lag reduction
[*]New shortcut
[/list]
[table]
[tr]
[th]World[/th]
[th][right]Frames saved[/right][/th]
[/tr]
[tr]
[td]Grass Land[/td]
[td][right]14[/right][/td]
[/tr]
[tr]
[td]Desert Land[/td]
[td][right]2[/right][/td]
[/tr]
[/table]
Which renders on the forum like this: Small Mario
  • Lots of lag reduction
  • New shortcut
World
Frames saved
Grass Land
14
Desert Land
2
Accessing TASVideos-specific markup Pandoc conversion doesn’t try to preserve anything about the input. You will get structural and semantic features like paragraphs, lists, tables, code blocks, links, bold, and italics, but you won’t get things like font sizes and colors. There are, however, ways to access TASVideos-specific markup, usually by setting classes or attributes. You can do this using either Markdown syntax (using Pandoc’s special extended Markdown):
::: {.spoiler}
Block attributes
:::

Inline [attributes]{.spoiler}
Or HTML syntax:
<div class="spoiler">
Block attributes
</div>

Inline <span class="spoiler">attributes</span>
For the [spoiler] tag, set the spoiler class. For the [highlight] tag, set the mark class. You can alternatively use the <mark> element in HTML input. For [note] and [warning], you can use the alerts syntax. Other tags, like [wiki], [post], and [movie], can be accessed with raw attributes and a format of tasvideos_forum:
`[wiki]ForumMarkup[/wiki]`{=tasvideos_forum}

This is `[frames]100[/frames]`{=tasvideos_forum} faster than `[movie]1234[/movie]`{=tasvideos_forum}
See the README for more features.