EditorJsonToHtmlConverter 1.0.0.5

Additional Details

Ignore these packages, the minimal version for use should be 1.0.0.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package EditorJsonToHtmlConverter --version 1.0.0.5
NuGet\Install-Package EditorJsonToHtmlConverter -Version 1.0.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EditorJsonToHtmlConverter" Version="1.0.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EditorJsonToHtmlConverter --version 1.0.0.5
#r "nuget: EditorJsonToHtmlConverter, 1.0.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EditorJsonToHtmlConverter as a Cake Addin
#addin nuget:?package=EditorJsonToHtmlConverter&version=1.0.0.5

// Install EditorJsonToHtmlConverter as a Cake Tool
#tool nuget:?package=EditorJsonToHtmlConverter&version=1.0.0.5

EditorJsonProcessor

Add service(s) to DI container if required:

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Services.AddScopedEditorJsonProcessorServices();

This will add both of the following into the service collection:

  • Microsoft.AspNetCore.Components.Web.HtmlRenderer
  • EditorJsonToHtmlConverter.EjsHtmlRenderer

Usage:

string editor_json = "{ ... editor json emitted from editor js ... }"
string html = await EjsHtmlRenderer.ParseAsync(editor_json);
HtmlRootComponent html_root_component = await EjsHtmlRenderer.ParseAsHtmlRootComponentAsync(editor_json);
<EjsRenderFragment Value="@editor_json" StylingMap="[]" />

Editor JSON Sample:

{
    "time": 1707325917682,
    "blocks": [
    {"id": "uM3Adn6C9n", "data": {"text": "!!! <i>He</i>y<b>lo, W</b>orld! <a href=\"https://google.com\">Link</a> !!!", "wrap": "title"}, "type": "text"},
    {
        "id": "KgrM3aNM-n",
        "type": "header",
        "data": {
        "text": "<mark class=\"cdx-marker\"><a href=\"http://google.com\">Heylo</a></mark>",
        "level": 1
        }
    },
    {
        "id": "NaTtEbbeRT",
        "type": "paragraph",
        "data": {
        "text": "Heylo World"
        }
    },
    {
        "id": "KgrM3aNM-n",
        "type": "header",
        "data": {
        "text": "Second header",
        "level": 3
        }
    },
    {
        "id": "QdqCFpKBAm",
        "type": "list",
        "data": {
        "style": "ordered",
        "items": [
            {
            "content": "A: One",
            "items": [
                {
                "content": "B: Two",
                "items": []
                }
            ]
            },
            {
            "content": "A: Three",
            "items": [
                {
                "content": "B: Four",
                "items": [
                    {
                    "content": "C: Five",
                    "items": []
                    }
                ]
                },
                {
                "content": "B: Six",
                "items": []
                },
                {
                "content": "B: Seven",
                "items": []
                }
            ]
            }
        ]
        }
    },
    {
        "id": "m-onbmz6BZ",
        "type": "quote",
        "data": {
        "text": "Ohhh interesting...",
        "caption": "by Me!",
        "alignment": "left"
        }
    },
    {
        "id": "ZatOSzA754",
        "type": "paragraph",
        "data": {
        "text": "dsf<i>sfa</i><b>sfasdfs</b>dffasd"
        }
    },
    {
        "id": "SWrBNzvp6A",
        "type": "list",
        "data": {
        "style": "unordered",
        "items": [
            {
            "content": "dwdw",
            "items": []
            },
            {
            "content": "wedwed",
            "items": []
            },
            {
            "content": "wedw",
            "items": []
            }
        ]
        }
    },
        
    {
        "id": "yD5ZHUxF1N",
        "type": "checklist",
        "data": {
        "items": [
            {
            "text": "Check List Item One",
            "checked": false
            },
            {
            "text": "Check List Item Two",
            "checked": true
            },
            {
            "text": "Check List Item Three",
            "checked": false
            }
        ]
        }
    },
    {
        "id": "J5I_aD9c8j",
        "type": "delimiter",
        "data": {}
    },
    {
        "id": "J-7FqxXppm",
        "type": "table",
        "data": {
        "withHeadings": true,
        "content": [
            [
            "Header 1",
            "Header 2",
            "Header 3"
            ],
            [
            "qwerty",
            "as<b>dfg</b>h",
            "zxc<mark class=\"cdx-marker\">vbn</mark>"
            ],
            [
            "AAA",
            "<a href=\"https://google.com/\">BBB</a>",
            "<code class=\"inline-code\">CCC</code>"
            ]
        ]
        }
    },
    {
        "id": "zOGIbPv7kl",
        "type": "table",
        "data": {
        "withHeadings": false,
        "content": [
            [
            "A1",
            "B1"
            ],
            [
            "A2",
            "B2"
            ]
        ]
        }
    },
    {
        "type": "image",
        "data": {
        "url": "https://www.tesla.com/tesla_theme/assets/img/_vehicle_redesign/roadster_and_semi/roadster/hero.jpg",
        "caption": "Roadster // tesla.com",
        "withBorder": true,
        "withBackground": false,
        "stretched": true
        }
    },
    {
        "type" : "delimiter",
        "data" : {}
    },
    {
        "type": "warning",
        "data": {
        "title": "Note:",
        "message": "Avoid using this method just for lulz. It can be very dangerous opposite your daily fun stuff."
        }
    },
    {
        "type" : "delimiter",
        "data" : {}
    },
    {
        "type" : "embed",
        "data" : {
        "service" : "coub",
        "source" : "https://coub.com/view/1czcdf",
        "embed" : "https://coub.com/embed/1czcdf",
        "width" : 580,
        "height" : 320,
        "caption" : "My Life"
        }
    }
    ],
    "version": "2.28.2"
}

Styling Map Sample:

[
    {
        "type": "header",
        "level": 1,
        "style": "specific-style",
        "id": "KgrM3aNM-n"
    },
    {
        "type": "header",
        "level": 3,
        "style": "general-style"
    },
    {
        "type": "paragraph",
        "style": "specific-style",
        "id": "NaTtEbbeRT"
    },
    {
        "type": "paragraph",
        "style": "general-style"
    },
    {
        "type": "list",
        "style": "list-group list-group-flush",
        "item-style": "list-group-item"
    },
    {
        "type": "checklist",
        "style": "list-group",
        "item-style": "list-group-item"
    },
    {
        "type": "quote",
        "style": "blockquote",
        "footer-style": "blockquote-footer"
    },
    {
        "type": "table",
        "style": "table table-hover"
    },
    {
        "type": "table",
        "style": "table table-striped",
        "id": "zOGIbPv7kl"
    },
    {
        "type": "image",
        "style": "img-fluid"
    }
]
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.9 77 6/14/2024
1.0.0.8 76 6/12/2024
1.0.0.7 74 6/12/2024
1.0.0.6 84 6/12/2024
1.0.0.5 89 6/12/2024
1.0.0.4 82 6/11/2024