Class MjStyle


public class MjStyle extends HeadComponent
Adds CSS styles from <mj-style> content to the rendered HTML. Supports inline="inline" attribute for styles that should be inlined.

Security note: mj-style passes CSS content through to the rendered HTML with minimal filtering (only </style> tag injection is stripped). Untrusted CSS can enable data exfiltration via url() references or attribute selectors that leak content. When processing untrusted MJML input, configure a ContentSanitizer to validate or strip dangerous CSS constructs before rendering.

  • Constructor Details

  • Method Details

    • getTagName

      public String getTagName()
      Description copied from class: BaseComponent
      Returns the MJML tag name this component handles.
      Specified by:
      getTagName in class BaseComponent
      Returns:
      the MJML tag name
    • process

      public void process()
      Description copied from class: HeadComponent
      Processes this head component, updating the global context with extracted metadata (fonts, styles, attributes, etc.).
      Specified by:
      process in class HeadComponent