WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

Support colored footnote marker & calls

Open anghenfil opened this issue 8 months ago • 1 comments

Hey,

I'm having issues to set the colour of footnote markers/calls.

This doesn't work:

.footnote::footnote-call {
    content: counter(footnote, decimal) " ";
    color: green;
    vertical-align: super;
    font-size: 0.8em;
}
 
.footnote::footnote-marker {
    content: counter(footnote, lower-roman);
    font-size: 14pt;
    color: red;
    display: inline-block;
    width: 2em;
    padding-right: 1em;
    text-align: right;
}

You can find a full example here, with comparisons to other printcss engines.

Best anghenfil

anghenfil avatar Apr 17 '25 22:04 anghenfil

Hi!

Thanks for the report.

It looks like there are 2 different problems:

  • .footnote::footnote-call and .footnote::footnote-marker don’t match the elements, but ::footnote-call and ::footnote-marker do. We have to check the specification to find exactly what’s supposed to work.
  • The color is not applied to the footnote marker. Maybe that’s related to the way we handle markers.

We’ll check that in depth and get back as soon as we understand what’s going on here.

liZe avatar Apr 18 '25 19:04 liZe

  • .footnote::footnote-call and .footnote::footnote-marker don’t match the elements, but ::footnote-call and ::footnote-marker do. We have to check the specification to find exactly what’s supposed to work.

There’s nothing in the specification about that. As it seems to work with other renderers, we can assume that it’s the way it should work.

liZe avatar Jun 23 '25 07:06 liZe

There’s nothing in the specification about that. As it seems to work with other renderers, we can assume that it’s the way it should work.

I’m not sure about that. Should the pseudo-element be p::footnote-marker or .footnote::footnote-marker? The second selector makes more sense to me, but it has an important consequence: the style of the marker inherits from the style of the footnote, and I’m not sure that this is what we want.

Even if that’s discutable, let’s go this way.

liZe avatar Jun 23 '25 08:06 liZe

  • The color is not applied to the footnote marker. Maybe that’s related to the way we handle markers.

That was just a bug for footnote markers.

liZe avatar Jun 23 '25 09:06 liZe