RickStrahl/Westwind.AspNetCore.Markdown

asp-for within MD?

crazycga opened this issue · 3 comments

Hey there. This is a great piece of software and is REALLY helping me with a project for a client. I'm a back-end type person, no problems with MVC. Well, with MC, anyway.

My question: I have an .MD form that I wish to present to the user and capture the response. The issue that asp-for doesn't resolve at the time that parsing operates. What I'm seeing is that (apprently) the asp-for decorators get resolved BEFORE the MD string is rendered on the page.

For reference, I'm doing something along the lines of:

<input type="text" asp-for="UserName" />

I'm able to render other HTML (within reason) on the markdown form, but this piece is vexing me.

Do you have any ideas how I could solve this problem?

Thanks in advance.
-J

Oh, and on the Razor page I've got:

<span style="font-family:Calibri Light; font-size:16pt;"> <markdown normalize-whitespace="false"> @ViewBag.TheOutput </markdown> </span>

I'm going to close this. I've worked out that I needed to make an extension - which I've done and is now available. Thanks.

AFAIK that should work without anything special **as long as you use the <markdown> tag helper and the expression is embedded in a Razor page (ie. the processor can parse it).

What doesn't work is to load Markdown from another source - file, or a binding expression and have that loaded Markdown expand - the only way it works is if the expression is in the actual Razor page/control code.

Here's the relevant bit from the original blog post.

https://weblog.west-wind.com/posts/2018/mar/23/creating-an-aspnet-core-markdown-taghelper-and-parser#razor-expressions-in-markdown