sadpandajoe commented on code in PR #43722:
URL: https://github.com/apache/superset/pull/43722#discussion_r3900826221


##########
superset-frontend/plugins/plugin-chart-handlebars/src/Handlebars.tsx:
##########
@@ -37,7 +37,16 @@ export default function Handlebars(props: HandlebarsProps) {
   const handlebarTemplateSource = formData.handlebarsTemplate
     ? formData.handlebarsTemplate
     : '{{data}}';
-  const templateSource = `${handlebarTemplateSource}\n${styleTemplateSource} `;
+  // Markdown only treats `<style>` as a raw-text block that may contain blank
+  // lines when the tag starts a block of its own. Appending it to the template
+  // instead let a template opening with an HTML tag absorb the tag, so the
+  // first blank line in the CSS closed that block and every rule after it was
+  // parsed as a paragraph and rendered as visible text. Putting the style
+  // block first, separated by a blank line, keeps the CSS out of any block the
+  // template opens and leaves the template's own rendering untouched.
+  const templateSource = styleTemplateSource

Review Comment:
   Moving the `<style>` block before the saved template changes positional CSS 
selectors. A template starting `<table class="report">` with 
`.report:first-child` matched before but no longer does once `<style>` is the 
first element child; can we preserve the template's DOM order while isolating 
its Markdown parsing?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to