Skip to content

This library replaces SVG text underline to rectangle underline.

Notifications You must be signed in to change notification settings

dominik-selmeci/svg-underline-replacer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Simple SVG underline replacer

This library replaces SVG <text style="text-decoration: underline;"> to <rect> underline.

It's useful when you try to convert SVG to PDF texts with underline by programs like Inkscape, CairoSVG and so on.

It replaces only simple text without any transformation and with no multiple tspan.

Usage

Include in header:

<script src="svgUnderline.js"></script>

svgUnderline.replaceAll(elements)

var texts = document.querySelectorAll('svg text');
svgUnderline.replaceAll(texts);

svgUnderline.replace(element)

var texts = document.querySelector('svg text');
svgUnderline.replace(text);

Code is inspired by underlineJS

About

This library replaces SVG text underline to rectangle underline.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published