-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
135211d
commit f51aa31
Showing
6 changed files
with
141 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# GEmojiSharp.AspNetCore 📦 | ||
|
||
[](https://github.com/hlaueriksson/GEmojiSharp/actions?query=workflow%3Abuild) [](https://www.codefactor.io/repository/github/hlaueriksson/gemojisharp) | ||
|
||
> GitHub Emoji for ASP.NET Core | ||
The package includes: | ||
|
||
- TagHelpers | ||
- HtmlHelpers | ||
|
||
## TagHelpers | ||
|
||
Update the `_ViewImports.cshtml` file, to enable tag helpers in all Razor views: | ||
|
||
```cshtml | ||
@addTagHelper *, GEmojiSharp.AspNetCore | ||
``` | ||
|
||
Use the `<emoji>` tag or `emoji` attribute to render emojis: | ||
|
||
```html | ||
<span emoji=":tada:"></span> | ||
<emoji>:tada: initial commit</emoji> | ||
``` | ||
|
||
Do you want to use emoji anywhere, on any tag, in the `body`? Then you can use the `BodyTagHelperComponent`. | ||
|
||
Registration via services container: | ||
|
||
```cs | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.Services.AddRazorPages(); | ||
builder.Services.AddTransient<ITagHelperComponent, BodyTagHelperComponent>(); | ||
``` | ||
|
||
Use any tag to render emojis: | ||
|
||
```html | ||
<h1>Hello, :earth_africa:</h1> | ||
``` | ||
|
||
## HtmlHelpers | ||
|
||
Update the `_ViewImports.cshtml` file, to enable HTML helpers in all Razor views: | ||
|
||
```cshtml | ||
@using GEmojiSharp.AspNetCore | ||
``` | ||
|
||
Use the `Emoji` extension methods to render emojis: | ||
|
||
```cshtml | ||
@Html.Emoji(":tada: initial commit") | ||
@Html.Emoji(x => x.Text) | ||
``` | ||
|
||
## Would you like to know more? 🤔 | ||
|
||
Further documentation is available at [https://github.com/hlaueriksson/GEmojiSharp](https://github.com/hlaueriksson/GEmojiSharp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# GEmojiSharp.Blazor 📦 | ||
|
||
[](https://github.com/hlaueriksson/GEmojiSharp/actions?query=workflow%3Abuild) [](https://www.codefactor.io/repository/github/hlaueriksson/gemojisharp) | ||
|
||
> GitHub Emoji for Blazor | ||
The package is a Razor class library (RCL) with a Razor component. | ||
|
||
Update the `_Imports.razor` file, to enable the component in all Razor views: | ||
|
||
```cshtml | ||
@using GEmojiSharp.Blazor | ||
``` | ||
|
||
Use the `<Emoji>` component to render emojis: | ||
|
||
```html | ||
<Emoji>:tada: initial commit</Emoji> | ||
``` | ||
|
||
## Would you like to know more? 🤔 | ||
|
||
Further documentation is available at [https://github.com/hlaueriksson/GEmojiSharp](https://github.com/hlaueriksson/GEmojiSharp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# GEmojiSharp 📦 | ||
|
||
[](https://github.com/hlaueriksson/GEmojiSharp/actions?query=workflow%3Abuild) [](https://www.codefactor.io/repository/github/hlaueriksson/gemojisharp) | ||
|
||
> GitHub Emoji for C# and .NET | ||
Static methods: | ||
|
||
```csharp | ||
Emoji.Get(":tada:").Raw; // 🎉 | ||
Emoji.Get("🎉").Alias(); // :tada: | ||
Emoji.Raw(":tada:"); // 🎉 | ||
Emoji.Alias("🎉"); // :tada: | ||
Emoji.Emojify(":tada: initial commit"); // 🎉 initial commit | ||
Emoji.Demojify("🎉 initial commit"); // :tada: initial commit | ||
Emoji.Find("party popper").First().Raw; // 🎉 | ||
``` | ||
|
||
Extension methods: | ||
|
||
```csharp | ||
":tada:".GetEmoji().Raw; // 🎉 | ||
"🎉".GetEmoji().Alias(); // :tada: | ||
":tada:".RawEmoji(); // 🎉 | ||
"🎉".EmojiAlias(); // :tada: | ||
":tada: initial commit".Emojify(); // 🎉 initial commit | ||
"🎉 initial commit".Demojify(); // :tada: initial commit | ||
"party popper".FindEmojis().First().Raw; // 🎉 | ||
``` | ||
|
||
Regular expression pattern to match all emojis: | ||
|
||
```csharp | ||
var text = "Lorem 😂😂 ipsum"; | ||
|
||
var matches = Regex.Matches(text, Emoji.RegexPattern); | ||
string.Join(string.Empty, matches.Select(x => x.Value)); // 😂😂 | ||
Regex.Replace(text, Emoji.RegexPattern, string.Empty); // Lorem ipsum | ||
``` | ||
|
||
## Would you like to know more? 🤔 | ||
|
||
Further documentation is available at [https://github.com/hlaueriksson/GEmojiSharp](https://github.com/hlaueriksson/GEmojiSharp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters