Layout + html safe extension
See original GitHub issue@adoconnection , I seem to have a problem after following the layout + html safe templating docs whereby the @RenderBody()
portion is html encoded… any suggestions?
It’s like it’s encoding the @RenderBody()
part when it’s already safe/encoded.
Edit: I think I have a solution, shout out if I’m missing any issues though.
- Modify
MyTemplateBase<T>
Include and RenderBody methods to returnobject
and be virtual. - Modify
MyHtmlTemplateBase<T>
(which inheritsMyTemplateBase<T>
) by overriding those two methods and have themreturn Raw(base.Include/RenderBody);
. - Need to move RawContent into its own
internal class
as it was previously private inside MyTemplateBase.
Like this, when WriteAsync
is called with the RenderBody() or Include() result, it’s already a RawContent
and the avoidance of html encoding happens.
Hope that helps someone else. Almost wonder if it’s worth adding this into the docs.
_Originally posted by @benmccallum in https://github.com/adoconnection/RazorEngineCore/issues/65#issuecomment-954703223_
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
html.to.design
With html.to.design, convert any website into fully editable Figma designs. ... this Chrome extension is a companion to the html.to.design Figma plugin, ...
Read more >HTML Layout Extensions
HTML Extensions To Improve Layout Control for Viewing and Printing Documents · Contents · Introduction · Column and Callout (region) Formatting.
Read more >Safely insert external content into a page - Mozilla | MDN
When working with externally sourced content that you know is HTML, sanitizing the HTML is essential before it's added to a page. Best...
Read more >HTML Programming with Visual Studio Code
HTML extensions Install an extension to add more functionality. Go to the Extensions view (Ctrl+Shift+X) and type 'html' to see a list...
Read more >html.to.design | Figma Community
Figma Community plugin - Convert any website into fully editable Figma designs. Leverage an existing website and import its html to Figma to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Gosh, sorry I’m not sure how I missed the extensions part of the readme which points to: https://github.com/wdcossey/RazorEngineCore.Extensions
Perhaps I should’ve just used that all along 🤦🏻♂️
👌👌