Conversation
- Replace with xoofx/markdig - Update package version in Directory.Packages.props - Update license entry in NOTICES.txt - Update package reference in src\Umbraco.Infrastructure\Umbraco.Infrastructure.csproj - Update src\Umbraco.Core\Composing\TypeFinder.cs - Update src\Umbraco.Infrastructure\HealthChecks\MarkdownToHtmlConverter.cs - Update src\Umbraco.Infrastructure\PropertyEditors\ValueConverters\MarkdownEditorValueConverter.cs
|
Hi there @gavinfaux, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
|
Perhaps this should be an extension or helper to enable use in other places / packages, just as Articulate uses? using Markdig;
namespace Umbraco.Extensions;
{
public static class MarkdownExtensions
{
private static readonly MarkdownPipeline s_markdownPipeline = new MarkdownPipelineBuilder()
.UseAdvancedExtensions()
.Build();
public static string ToHtml(string input) => Markdown.ToHtml(input, s_markdownPipeline);
}
} |
There was a problem hiding this comment.
Thanks for this @gavinfaux - it's a good catch, and I agree we should update this to the supported library. I'd suggest the following things to consider if you are up for some modifications:
- As this is a breaking change and 16 is very close, I think the earliest we can introduce this change would be 17, so please could you re-target to
v17/dev? - I'm not sure about the extension method suggestion, some people frown on polluting the generic string too much (in the sense that the proposed method will be visible on all strings, not the small fraction of them that contain markdown).
- Rather maybe we should make better use of the existing
IMarkdownToHtmlConverter? Developers could inject and use that if they needed this service. But that should have some small changes:- It currently lives in a namespace that indicates it's only used for health checks. Likely the interface and implementation should be moved to the namespace
Umbraco.Cms.Core.StringsUmbraco.Cms.Infrastructure.Stringsrespectively (and the files moved on disk to the corresponding folders). - It currently has some code specific for handling the strings found in health check results. I feel they should be removed and put in
EmailNotificationMethoddirectly. - We should ourselves inject and use this in
MarkdownEditorValueConverterrather than referencing the Markdown library directly.
- It currently lives in a namespace that indicates it's only used for health checks. Likely the interface and implementation should be moved to the namespace
|
Aha! Will close PR and target against |
|
This line: That would make enabling additional (custom) extensions rather easy. Any reason you are enabling the AdvancedExtensions by default, though? |
|
I've picked this up again in #21242. |
|
Thank you. I did look at this but was unsure of on a couple of points/breaking changes, perhaps documentation updates suffice and end users can override defaults via DI/Composition if needed.
I should have raised/asked this a while ago, apologies! |
Prerequisites
If there's an existing issue for this PR then this fixes #19500
Description