Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/butr/converter.markdowntobbcode
Converts Markdown and HTML into NexusMods and Steam BBCode flavor
https://github.com/butr/converter.markdowntobbcode
bbcode html5 markdown markdown-converter nexusmods steam
Last synced: 9 days ago
JSON representation
Converts Markdown and HTML into NexusMods and Steam BBCode flavor
- Host: GitHub
- URL: https://github.com/butr/converter.markdowntobbcode
- Owner: BUTR
- License: mit
- Created: 2023-07-19T18:07:02.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-25T21:23:44.000Z (12 months ago)
- Last Synced: 2023-11-25T22:24:09.251Z (12 months ago)
- Topics: bbcode, html5, markdown, markdown-converter, nexusmods, steam
- Language: C#
- Homepage:
- Size: 84 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Converter.MarkdownToBBCode
Converts Markdown and HTML (GitHub flavor) into NexusMods and Steam BBCode flavor. Might be opionated with the HTML conversion, since there are a few ways to interpret HTML### Installation
```shell
dotnet tool install -g Converter.MarkdownToBBCodeNM.Tool
dotnet tool install -g Converter.MarkdownToBBCodeSteam.Tool
```### Usage
When installed as a global tool:
```shell
# NexusMods
markdown_to_bbcodenm -i "**raw markdown**"
markdown_to_bbcodenm -i "~~raw\r\nmarkdown~~" --disableextendedmarkdown_to_bbcodenm -i "/markdown.md";
markdown_to_bbcodenm -i "/markdown.md" -o "/bbcode.txt";# Steam
markdown_to_bbcodesteam -i "**raw markdown**"
markdown_to_bbcodesteam -i "~~raw\r\nmarkdown~~" --disableextendedmarkdown_to_bbcodesteam -i "/markdown.md";
markdown_to_bbcodesteam -i "/markdown.md" -o "/bbcode.txt";
```
`-i or --input` accepts both raw markdown and a file path.
`-o or --output` accepts a file path. If specified, will write the
converted BBCode to the file instead of outputting to the console.
`-d or --disableextended` will disable newline detection via two spaces
and will disable HTML conversion## Example
At the time of writing the tool, it was used to keep in sync the description of the BLSE mod for Bannerlord.
BLSE - [GitHub](https://github.com/BUTR/Bannerlord.BLSE) -> [NexusMods](https://www.nexusmods.com/mountandblade2bannerlord/mods/1)
MCM - [GitHub](https://github.com/Aragas/Bannerlord.MBOptionScreen) -> [NexusMods](https://www.nexusmods.com/mountandblade2bannerlord/mods/612) & [GitHub](https://github.com/Aragas/Bannerlord.MBOptionScreen) -> [Steam](https://steamcommunity.com/sharedfiles/filedetails/?id=2859238197)## Notes
* You can ignore an HTML element by adding `converter_ignore`, `converter_nexusmods`, `converter_steam` attribute to the element
```HTML
WILL NOT BE CONVERTED TO BBCODE
WILL NOT BE CONVERTED TO BBCODE FOR STEAM
WILL NOT BE CONVERTED TO BBCODE FOR NEXUSMODS
```
* You can set an alternative `href` for a link for NexusMods/Steam by adding a `nexusmods_href` or `steam_href` attribute to the element
```HTML
```
* You can set an alternative `src` for an image for NexusMods/Steam by adding a `nexusmods_src` or `steam_src` attribute to the element
```HTML
```
## Supporting Codes
[GitHub Markdown Supported HTML Codes](https://github.com/gjtorikian/html-pipeline/blob/a2e02ac8372da5376cde623466dfaeb0f2b2ea1c/lib/html_pipeline/sanitization_filter.rb)
[Steam Supported BBCode Codes](https://steamcommunity.com/comment/ForumTopic/formattinghelp)| NexusMods BBCode | Steam BBCode | Markdown (GitHub) | HTML |
|----------------------------------------|------------------------------------|---------------------------------------------------------------------------|------------------------------------------------------------------------|
| \[b\]TEXT\[\b] | \[b\]TEXT\[\b] | \*\*TEXT\*\* | \TEXT\ |
| \[i\]TEXT\[/i] | \[i\]TEXT\[/i] | \*TEXT\* | \TEXT\ |
| \[u]TEXT\[/u] | \[u]TEXT\[/u] | | \TEXT\ OR \TEXT\ |
| \[s]TEXT\[/s] | \[strike]TEXT\[/strike] | \~\~TEXT\~\~ | \TEXT\ OR \TEXT\ |
| \[url=URL]TEXT\[/url] | \[url=URL]TEXT\[/url] | \[TEXT\]\(URL\) | \TEXT\ |
| \[img]URL\[/img] | \[img]URL\[/img] | \!\[Alt text\]\(URL\) | \\ |
| \[quote]TEXT\[/quote] | \[quote]TEXT\[/quote] | \> TEXT | \TEXT\|
| \[quote AUTHOR]TEXT\[/quote] | \[quote=AUTHOR]TEXT\[/quote] | \> TEXT | |
| \[code]CODE\[/code] | \[code]CODE\[/code] | \`\`\`CODE\`\`\` | \CODE\
|
| \[list=1]\[*]ENTRY\[/list] | \[olist]\[*]ENTRY\[/olist] | 1. ENTRY | \\
|- ENTRY\
\
| \[list]\[*]ENTRY\[/list] | \[list]\[*]ENTRY\[/list] | \* ENTRY | \
- \
- ENTRY\ \
| \[line] | \[hr]\[/hr] | | \
|
| \[color=COLOR]TEXT\[/color] | | | |
| \[font=FONT]TEXT\[/font] | | | |
| \[center]TEXT\[/center] | | | \
TEXT\
OR \| \[right]TEXT\[/right] | | | \
TEXT\
OR \| \[left]TEXT\[/left] | | | \
TEXT\
OR \| \[size=1]TEXT\[/size] | \[h6]TEXT\[/h6] | ###### TEXT | \
TEXT\
|| \[size=2]TEXT\[/size] | \[h5]TEXT\[/h5] | ##### TEXT | \
TEXT\
|| \[size=3]TEXT\[/size] | \[h4]TEXT\[/h4] | #### TEXT | \
TEXT\
|| \[size=4]TEXT\[/size] | \[h3]TEXT\[/h3] | ### TEXT | \
TEXT\
|| \[size=5]TEXT\[/size] | \[h2]TEXT\[/h2] | ## TEXT | \
TEXT\
|| \[size=6]TEXT\[/size] | \[h1]TEXT\[/h1] | # TEXT | \
TEXT\
|| \[spoiler]SUMMARY\\n\\rTEXT\[/spoiler] | INLINE SPOILERS NOT MAPPED TO HTML | | \\SUMMARY\TEXT\ |
| \[youtube]ID\[/youtube] | https://www.youtube.com/watch?v=ID | \[https://www.youtube.com/watch?v=ID](https://www.youtube.com/watch?v=ID) | |