svg-add-space

1.0.1 • Public • Published

Use Case

If you ever try to copy the multiple lines of text in SVG, you will get this:

This is English. You needto add space for every<text> element in thisFrame Textexceptthelast line.

Note that there is no space before linebreak, so you will see words like needto and Textexceptthelast.

This tool will insert 1 space before each linebreak, so anyone can copy the text without wordslikethis.

Usages

cat in.svg | node index.js > out.svg
node index.js in.svg > out.svg
node index.js in.svg out.svg

Mechanics

This tool will add one space to any g > text:not(:last-child) that is not CJK.

Before:

<g>
    <text>line1</text>
    <text>line2</text>
</g>

After:

<g>
    <text>line1 </text>
    <text>line2</text>
</g>

What is 'beforeend'?

<!-- beforebegin -->
<text>
<!-- afterbegin -->
foo
<!-- beforeend -->
</text>
<!-- afterend -->

Readme

Keywords

none

Package Sidebar

Install

npm i svg-add-space

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

5.71 kB

Total Files

6

Last publish

Collaborators

  • buckle2000