Skip to content

Commit e02a3d5

Browse files
authored
Merge pull request #1 from jcdcdev/dev
0.1.0
2 parents 1981d4d + 7e14506 commit e02a3d5

File tree

46 files changed

+3254
-2391
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3254
-2391
lines changed

.github/README.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,42 @@
55
[![GitHub license](https://img.shields.io/github/license/jcdcdev/jcdcdev.Umbraco.ExtendedMarkdownEditor?color=8AB803)](https://github.com/jcdcdev/jcdcdev.Umbraco.ExtendedMarkdownEditor/blob/main/LICENSE)
66
[![Downloads](https://img.shields.io/nuget/dt/jcdcdev.Umbraco.ExtendedMarkdownEditor?color=cc9900)](https://www.nuget.org/packages/jcdcdev.Umbraco.ExtendedMarkdownEditor/)
77

8-
Get more from the Umbraco Markdown editor. Provides access to the raw Markdown and transformed HTML. Adds data type configuration to control Markdown to HTML settings.
8+
A lightweight custom property editor for Umbraco that sits on top of the default Umbraco.MarkdownEditor.
99

10-
## Quick Start
10+
## Features
11+
12+
### Property Value Converter
13+
14+
Replaces `IHtmlEncodedString` with `MarkdownValue` which contains the following properties
15+
16+
- **Raw** - The raw markdown as a string
17+
- **Html** - The transformed HTML value
18+
- **Markdown** - The Markdig MarkdownDocument
19+
20+
### Data Type
21+
22+
Extends the configuration to allow control over the transformation of Markdown to HTML
1123

12-
## Configuration
24+
- **Header Offset** - The offset to apply to the header levels
25+
- For example: `-1` would transform `# Header 1` to `<h2>Header 1</h2>`
26+
- **External Links** Open In New Tab - Adds `target="_blank"` to external links
27+
28+
### Plug and Play
29+
30+
All existing and future properties using Umbraco.MarkdownEditor will automatically use the new editor.
31+
32+
Removing this package will revert to the default Umbraco.MarkdownEditor, **no data loss will occur**.
33+
34+
## Quick Start
1335

14-
## Extending
36+
```csharp
37+
dotnet add package jcdcdev.Umbraco.ExtendedMarkdownEditor
38+
```
1539

1640
## Contributing
1741

18-
Contributions to this package are most welcome! Please read the [Contributing Guidelines](https://github.com/jcdcdev/jcdcdev.Umbraco.ExtendedMarkdownEditor/blob/main/.github/CONTRIBUTING.md).
42+
Contributions to this package are most welcome! Please read
43+
the [Contributing Guidelines](https://github.com/jcdcdev/jcdcdev.Umbraco.ExtendedMarkdownEditor/blob/main/.github/CONTRIBUTING.md).
1944

2045
## Acknowledgments (thanks!)
2146

docs/icon.png

51.6 KB
Loading

docs/screenshots/content.png

94.5 KB
Loading

docs/screenshots/datatype.png

47.2 KB
Loading

docs/screenshots/html-raw.png

40.6 KB
Loading

docs/screenshots/html.png

43.3 KB
Loading

docs/screenshots/markdown.png

33.2 KB
Loading
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@inherits UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem<MarkdownBlock>>
2+
3+
@if (!Model.Content.Markdown?.IsValid ?? true)
4+
{
5+
<div class="alert alert-danger">
6+
<strong>Markdown block error:</strong> The markdown block is not valid.
7+
</div>
8+
return;
9+
}
10+
11+
<div>
12+
<div>
13+
<span class="display-3">Raw HTML</span>
14+
<pre><code>@Html.Raw(Html.Encode(Model.Content.Markdown.Html))</code></pre>
15+
</div>
16+
<div>
17+
<span class="display-3">Markdown</span>
18+
<pre><code>@Model.Content.Markdown.Raw</code></pre>
19+
</div>
20+
<div>
21+
<span class="display-3">Rendered HTML</span>
22+
@Html.Raw(Model.Content.Markdown.Html)
23+
</div>
24+
</div>

src/TestSite.10/uSync/v9/Content/home.config

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Content Key="8aa88365-4221-4886-a491-0e968a95b93f" Alias="Home" Level="1">
3-
<Info>
4-
<Parent Key="00000000-0000-0000-0000-000000000000"></Parent>
5-
<Path>/Home</Path>
6-
<Trashed>false</Trashed>
7-
<ContentType>home</ContentType>
8-
<CreateDate>2024-03-25T22:54:59</CreateDate>
9-
<NodeName Default="Home" />
10-
<SortOrder>0</SortOrder>
11-
<Published Default="true" />
12-
<Schedule />
13-
<Template Key="d5d4d7dd-c931-4137-b199-40ae17562532">home</Template>
14-
</Info>
15-
<Properties>
16-
<gridContent>
17-
<Value><![CDATA[{
3+
<Info>
4+
<Parent Key="00000000-0000-0000-0000-000000000000"></Parent>
5+
<Path>/Home</Path>
6+
<Trashed>false</Trashed>
7+
<ContentType>home</ContentType>
8+
<CreateDate>2024-03-25T22:54:59</CreateDate>
9+
<NodeName Default="Home"/>
10+
<SortOrder>0</SortOrder>
11+
<Published Default="true"/>
12+
<Schedule/>
13+
<Template Key="d5d4d7dd-c931-4137-b199-40ae17562532">home</Template>
14+
</Info>
15+
<Properties>
16+
<gridContent>
17+
<Value><![CDATA[{
1818
"layout": {
1919
"Umbraco.BlockGrid": [
2020
{
@@ -51,6 +51,12 @@
5151
],
5252
"columnSpan": 12,
5353
"rowSpan": 1
54+
},
55+
{
56+
"contentUdi": "umb://element/bcfc3a0a1c5044c78eb0ea2b9fa8dadb",
57+
"areas": [],
58+
"columnSpan": 12,
59+
"rowSpan": 1
5460
}
5561
]
5662
},
@@ -78,10 +84,15 @@
7884
{
7985
"contentTypeKey": "98b3a50f-1496-4a9d-b863-f150b1032e83",
8086
"udi": "umb://element/ca8ed1bd7db64271b39e14249904a729"
87+
},
88+
{
89+
"contentTypeKey": "46a370af-6c5a-482e-a0ff-d67a4f027a64",
90+
"udi": "umb://element/bcfc3a0a1c5044c78eb0ea2b9fa8dadb",
91+
"markdown": "# This was a Heading 1\n\n## This was a Heading 2\n\n### This was a Heading 3\n\n**This is bold text**\n\n*This is italic text*\n\n[This is a link](/umbraco)\n\n[This is an external link](https://www.github.com/jcdcdev/jcdcdev.Umbraco.ExtendedMarkdownEditor)\n\n![This is an image](https://raw.githubusercontent.com/jcdcdev/jcdcdev.Umbraco.ExtendedMarkdownEditor/main/docs/icon.png \"Image description\")\n\n- Item 1\n- Item 2\n- Item 3\n\n> This is a blockquote\n\n1. First item\n2. Second item\n3. Third item"
8192
}
8293
],
8394
"settingsData": []
8495
}]]></Value>
85-
</gridContent>
86-
</Properties>
87-
</Content>
96+
</gridContent>
97+
</Properties>
98+
</Content>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ContentType Key="46a370af-6c5a-482e-a0ff-d67a4f027a64" Alias="markdownBlock" Level="1">
3+
<Info>
4+
<Name>Markdown Block</Name>
5+
<Icon>icon-document</Icon>
6+
<Thumbnail>folder.png</Thumbnail>
7+
<Description></Description>
8+
<AllowAtRoot>False</AllowAtRoot>
9+
<IsListView>False</IsListView>
10+
<Variations>Nothing</Variations>
11+
<IsElement>true</IsElement>
12+
<HistoryCleanup>
13+
<PreventCleanup>False</PreventCleanup>
14+
<KeepAllVersionsNewerThanDays></KeepAllVersionsNewerThanDays>
15+
<KeepLatestVersionPerDayForDays></KeepLatestVersionPerDayForDays>
16+
</HistoryCleanup>
17+
<Compositions/>
18+
<DefaultTemplate></DefaultTemplate>
19+
<AllowedTemplates/>
20+
</Info>
21+
<Structure/>
22+
<GenericProperties>
23+
<GenericProperty>
24+
<Key>e841e5e9-f5bf-4345-985f-ee687354036c</Key>
25+
<Name>Markdown</Name>
26+
<Alias>markdown</Alias>
27+
<Definition>c322755d-6a6e-4e1b-9026-781ee6dd4944</Definition>
28+
<Type>Umbraco.MarkdownEditor</Type>
29+
<Mandatory>false</Mandatory>
30+
<Validation></Validation>
31+
<Description><![CDATA[]]></Description>
32+
<SortOrder>0</SortOrder>
33+
<Tab Alias="content">Content</Tab>
34+
<Variations>Nothing</Variations>
35+
<MandatoryMessage></MandatoryMessage>
36+
<ValidationRegExpMessage></ValidationRegExpMessage>
37+
<LabelOnTop>false</LabelOnTop>
38+
</GenericProperty>
39+
</GenericProperties>
40+
<Tabs>
41+
<Tab>
42+
<Key>4e6e6104-da67-442e-960d-fc34b249c882</Key>
43+
<Caption>Content</Caption>
44+
<Alias>content</Alias>
45+
<Type>Group</Type>
46+
<SortOrder>0</SortOrder>
47+
</Tab>
48+
</Tabs>
49+
</ContentType>

0 commit comments

Comments
 (0)