Skip to content

CSS warning from default code block styling unless -mdfx-code-block-* properties are set explicitly #100

@Dansoftowner

Description

@Dansoftowner

When using jpro-mdfx's MarkdownView, JavaFX prints CSS conversion warnings for code block styling.

Environment

  • jpro-mdfx: 0.6.2
  • JavaFX: 26
  • OpenJDK 25
  • OS: Windows

Warning

javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint
(java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics@26 of loader 'app')'
while converting value for '-fx-border-color' from rule '*.markdown-code-background' in stylesheet jar:file:///.../mdfx/mdfx.css

WARNING: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint 
(java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics@26 of loader 'app')' 
while converting value for '-fx-background-color' from rule '*.markdown-code-block *.code-text-flow' in stylesheet jar:file:///.../mdfx/mdfx.css

Behavior

The warning appears when rendering Markdown that includes a code block with the default jpro-mdfx styling.
If I explicitly define these CSS properties in my application stylesheet, the warnings disappear:

* {
    /* ... */
    -mdfx-code-block-border: /* My color */;
    -mdfx-code-block-background: /* My color */;
}

Expected behavior

MarkdownView should not emit JavaFX CSS warnings with its default stylesheet/settings. If these properties are required for code block rendering, it would be helpful if jpro-mdfx provided safe default values.

Actual behavior

Without explicitly setting -mdfx-code-block-border and -mdfx-code-block-background, JavaFX logs a ClassCastException warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions