MarkdownViewEngine icon indicating copy to clipboard operation
MarkdownViewEngine copied to clipboard

Feature request: CommonMarkSettings

Open jskeet opened this issue 8 years ago • 10 comments

I need to be able to resolve some custom URIs ("noda-type://" etc) - I believe I can do this with CommonMarkSettings but there's no way of providing any in MarkdownViewEngine. This could be a property in MarkdownViewEngineOptions, then passed along in MarkdownPage.

jskeet avatar Jan 26 '17 19:01 jskeet

I used CommonMarkdown only for converting the markdown to html, regarding the feature that you requested I was thinking to support this via the MarkdownViewEngineOptions but this will affect all the views, if you a good plan for this you always welcome

hishamco avatar Jan 26 '17 20:01 hishamco

For my use case, that would be absolutely fine.

jskeet avatar Jan 26 '17 20:01 jskeet

Yep, but I'm looking for a general solution, not for particular project 😄

hishamco avatar Jan 26 '17 21:01 hishamco

I suspect app-wide CommonMarkSettings will be pretty common - a view-specific way of providing settings would be nice as well, perhaps as part of the directives.

jskeet avatar Jan 26 '17 21:01 jskeet

Assume we have the following:

@page layout="_SiteLayout" title="Home"

how may the settings will be look like?!! coz we may have a lot of settings, if you have a good idea, please share it

hishamco avatar Jan 26 '17 21:01 hishamco

The Razor style would make sense to me:

@Page {
  Title = ...,
  Layout = ...,
  // Other settings here, and this is general purpose C#
}

jskeet avatar Jan 26 '17 21:01 jskeet

Regarding to me I want the directive as simple as possible, it's similar to what we have seen in ASP.NET WebForms

<%@ Page attribute="value" [attribute="value"...] %>

So if the requested attribute is not related to the page behavior, I prefer to pass them here https://github.com/hishamco/MarkdownViewEngine/blob/master/samples/MarkdownViewEngineSample/Startup.cs#L13

hishamco avatar Jan 26 '17 21:01 hishamco

Yes, per-app settings should definitely be settable there - it's only if there are page-specific settings

jskeet avatar Jan 26 '17 21:01 jskeet

By the way, for app-wide settings you should be able to change the properties on the global CommonMarkSettings.Default and thus change the way it processes the markdown.

It was made this way with the intention to allow application to override how a intermediate library uses CommonMark.NET.

Knagis avatar Feb 06 '17 10:02 Knagis

It is pleasure to hear from you @Knagis, the CommonMark.NET was helping me a lot.

The PR #7 https://github.com/hishamco/MarkdownViewEngine/blob/commonMarkdownSettings/src/MarkdownViewEngine/MarkdownViewEngineOptions.cs#L10 is achieve the requested feature, by I'm asking myself if we can expose an MDVE object that has the common properties in CommonMarkSettings that used by devs or keep it as it is.

Please if you have ideas regarding the whole MDVE I will be appreciate it

hishamco avatar Feb 06 '17 11:02 hishamco