Open ricardoboss opened 11 months ago
May not be so trivial. Roslyn doesn't seem to have an actual semantic model for the DOM; it writes most of it as literals. E.g.,
<head>
<title></title>
<style type="text/css">
* { text-align: center;
}
</style>
…seems to become:
WriteLiteral("\n<!DOCTYPE html>\n\n<html lang=\"en\">\n");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("head", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "…", async() => {
WriteLiteral("\n <title></title>\n\n <style type=\"text/css\">\n * { text-align: center;\n }\n </style>\n\n ");
We can debug this behavior with <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
in the .csproj
.
Might be doable.
4>Sample.cshtml(25,11): Warning RzMa0001 : The tag '<details>' has limited support
So I have a proof of concept, of sorts.
csproj
, you define at least the <RazorMailAnalyzer_RequiredMailClients>gmail,outlook,apple-mail</RazorMailAnalyzer_RequiredMailClients>
property; optionally also <RazorMailAnalyzer_OptionalMailClients>
. The first contains e-mail clients that, if they don't fully support your markup, will raise a warning. The second contains e-mail clients that show as an informational message. (I've also considered making it three properties Error/Warning/Informational, so choosing the severity is more flexible and intuitive?)gmail,outlook@windows,apple-mail@ios
.Now, here come some caveats, aside from development for this being a drag (I've had VS crash, I've had the analyzer silently decide not to work, etc.):
This would allow us to integrate https://www.caniemail.com/api/data.json and display warnings if we are using features not supported by our mail client targets.