https://github.com/aolde/shortcoder
Add support for Wordpress Shortcodes in a .NET application.
https://github.com/aolde/shortcoder
Last synced: 5 months ago
JSON representation
Add support for Wordpress Shortcodes in a .NET application.
- Host: GitHub
- URL: https://github.com/aolde/shortcoder
- Owner: aolde
- License: mit
- Created: 2015-04-15T08:07:13.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-04-06T08:50:47.000Z (about 10 years ago)
- Last Synced: 2025-08-01T08:49:37.146Z (11 months ago)
- Language: C#
- Homepage:
- Size: 1.28 MB
- Stars: 15
- Watchers: 1
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Shortcoder
[](https://ci.appveyor.com/project/simplyio/shortcoder)
> Add support for Wordpress Shortcodes in a .NET application.
## Project Status
- Parsing works in most cases, but more tests need to be added for edge cases.
## Installation
Install through NuGet:
> Install-Package Shortcoder -Pre
Follow steps below to get started.
## Quick Sample Usage
1. Create a Shortcode class.
```csharp
public class NowShortcode : Shortcode
{
public override string Generate(IShortcodeContext context)
{
return DateTime.Now.ToString();
}
}
```
2. Register the shortcode.
```csharp
ShortcodeFactory.Provider.Add(tag: "now");
```
3. Parse content using registered shortcodes
```csharp
var content = "The date and time is: [now].";
var parsedContent = ShortcodeFactory.Parser.Parse(body);
```
*Result:*
```
parsedContent == "The date and time is: 2015-01-01 10:10:00."
```
## License
See [LICENSE](LICENSE.txt)