Skip to content

SVG sanitizer is affecting SVG layout #1160

Description

@macaba

Issue

When adding an SVG image to readme.md - the sanitizer is affecting my SVG image as all the text is now misaligned.

Sanitized SVG:
https://raw.githubusercontent.com/macaba/Markdig.Extensions.ScriptCs/master/Images/oxyplot.svg?sanitize=true

The markdown used in readme.md is:

![./Images/oxyplot.svg](./Images/oxyplot.svg)

Diagnosis

Looking at the SVG produced by the sanitizer, all my <text> nodes are missing the dominant-baseline="hanging" attribute which is used in the source image to align the text correctly.

Before

<text dominant-baseline="hanging" text-anchor="middle" transform="translate(41.998,381.947)" font-family="Segoe UI" font-size="12" font-weight="400" fill="black">0</text>

After

<text text-anchor="middle" transform="translate(41.998,381.947)" font-family="Segoe UI" font-size="12" font-weight="400" fill="black">0</text>

Interesting

Page demonstrating various values of dominant-baseline
http://bl.ocks.org/eweitnauer/7325338

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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