Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sgbj/bbcodeparser
A BBCode parser for the .NET framework
https://github.com/sgbj/bbcodeparser
Last synced: 8 days ago
JSON representation
A BBCode parser for the .NET framework
- Host: GitHub
- URL: https://github.com/sgbj/bbcodeparser
- Owner: sgbj
- Created: 2013-11-07T23:30:05.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-27T19:12:51.000Z (almost 11 years ago)
- Last Synced: 2023-08-03T07:23:04.077Z (over 1 year ago)
- Language: C#
- Size: 113 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
BBCodeParser
============A BBCode parser for the .NET framework.
The parser and lexer were generated with ANTLR 4.
Configuring and adding new BBCode rules is simple and easy.
Examples
--------```csharp
var bbc = new BBC();bbc["[code]{text}[/code]"] =
_ => "" + _.text + "";bbc["[b]{text}[/b]"] =
_ => "" + bbc.Transform(_.text) + "";bbc["[i]{text}[/i]"] =
_ => "" + bbc.Transform(_.text) + "";bbc["[date/]"] =
_ => DateTime.Now.ToShortDateString();bbc["[url={url}]{text}[/url]"] =
_ => "" + _.text + "";
Console.WriteLine(bbc.Transform("[date/] [b]this is bold[/b] and [code]this is [b]code[/b][/code]\nand this is [b]bold [i]italic[/i][/b]\n[url='http://google.com']test[/url]"));
```Or for the default BBCode->HTML support, just do:
```csharp
Console.WriteLine(BBCode.Basic().Transform("[b]Awesome[/b]"));
```