Insert generated carbon SVG in GitHub README
See original GitHub issueDescribe the bug
Github readme allows inserting svg images in readmes directly from repository. But it renders them wrong. It seems that carbon generates lots of overhead in svgs, also github doesn’t display it correct, eg:
The source part:
<svg xmlns="http://www.w3.org/2000/svg" width="996" height="762">
<foreignObject x="0" y="0" width="100%" height="100%">
<div xmlns="http://www.w3.org/1999/xhtml" id="export-container" class="jsx-425417836 export-container" style="animation: 0s ease 0s 1 normal none running none; background: none; border: 0px none rgb(255, 255, 255); border-radius: 0px; border-collapse: separate; bottom: auto; box-shadow: none; box-sizing: border-box; break-after: auto; break-before: auto; break-inside: auto; caption-side: top; clear: none; clip: auto; color: rgb(255, 255, 255); content: normal; cursor: auto; direction: ltr; display: flex; empty-cells: show; float: none; font: 400 18px / 24px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif; font-kerning: auto; height: 762px; image-rendering: auto; left: auto; letter-spacing: normal; list-style: outside none disc; margin: 0px; max-height: none; max-width: none; min-height: auto; min-width: auto; object-fit: fill; object-position: 50% 50%; opacity: 1; orphans: 2; outline: rgb(255, 255, 255) none 0px; outline-offset: 0px; overflow-wrap: normal; overflow: hidden; padding: 0px; pointer-events: auto; position: static; resize: none; right: auto; speak: normal; table-layout: auto; tab-size: 8; text-align: start; text-align-last: auto; text-decoration: none solid rgb(255, 255, 255); text-underline-position: auto; text-indent: 0px; text-rendering: optimizelegibility; text-shadow: none; text-size-adjust: auto; text-overflow: clip; text-transform: none; top: auto; touch-action: auto; transition: all 0s ease 0s; unicode-bidi: normal; vertical-align: baseline; visibility: visible; white-space: normal; widows: 2; width: 996px; will-change: auto; word-break: normal; word-spacing: 0px; z-index: auto; -webkit-appearance: none; backface-visibility: visible; border-spacing: 0px; -webkit-border-image: none; -webkit-box-align: center; -webkit-box-decoration-break: slice; -webkit-box-flex: 0; -webkit-box-ordinal-group: 1; -webkit-box-orient: horizontal; -webkit-box-pack: center; columns: auto auto; column-rule: 0px none rgb(255, 255, 255); column-span: none; flex: 0 1 auto; flex-flow: column nowrap; -webkit-font-smoothing: antialiased; grid-auto-columns: auto; grid-auto-flow: row; grid-auto-rows: auto; grid-area: auto / auto / auto / auto; grid-template-areas: none; grid-template-columns: none; grid-template-rows: none; hyphens: manual; -webkit-margin-collapse: collapse collapse; -webkit-mask-box-image-outset: 0px; -webkit-mask-box-image-repeat: stretch; -webkit-mask-box-image-slice: 0 fill; -webkit-mask-box-image-source: none; -webkit-mask-box-image-width: auto; -webkit-mask: none 0% 0% / auto repeat border-box border-box; -webkit-mask-composite: source-over; order: 0; perspective: none; perspective-origin: 249.047px 190.5px; shape-outside: none; shape-image-threshold: 0; shape-margin: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0.18); transform: scale(2); transform-origin: center center; transform-style: flat; -webkit-user-drag: auto; clip-path: none; clip-rule: nonzero; mask: none; filter: none; flood-color: rgb(0, 0, 0); flood-opacity: 1; lighting-color: rgb(255, 255, 255); stop-color: rgb(0, 0, 0); stop-opacity: 1; color-interpolation: srgb; color-interpolation-filters: linearrgb; color-rendering: auto; fill: rgb(0, 0, 0); fill-opacity: 1; fill-rule: nonzero; marker: none; mask-type: luminance; shape-rendering: auto; stroke: none; stroke-dasharray: none; stroke-dashoffset: 0px; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-opacity: 1; stroke-width: 1px; alignment-baseline: auto; baseline-shift: 0px; dominant-baseline: auto; text-anchor: start; writing-mode: horizontal-tb; line-break: auto;">
...
To Reproduce
- Export SVG from carbon.now.sh
- Drop it into repository
- Add markdown readme link
![](image.svg)
Expected behavior No redundant styles exported, minimal size, no side-effects. See termtosvg for example of generated SVG.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Generated SVG is shown as a blank image when imported ...
Generated svg will appear as a blank image when imported to google slides/drawings or ... Insert generated carbon SVG in GitHub README #943....
Read more >carbon/README.md at main - GitHub
This is the recommended method for sharing Carbon on your own website or blog. Readers can even copy the code with the click...
Read more >carbon-icons/usage.md at master - GitHub
Install carbon-icons and svgxuse so you can use carbon-icons.svg and svgxuse.js. ... Use the SVG sprite (carbon-icons.svg) by serving it as a static...
Read more >carbon-icons/CONTRIBUTING.md at master - GitHub
Make a pull request and add new icons to src/svg folder. You can also create a new issue with your SVG code; copy...
Read more >How to use the resulting SVG on GitHub markdown · Issue #61
It looks like the SVG in the README of termtosvg uses github.io to host the SVG. When the ![](./img/foo.svg) syntax used, the rendered ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mfix22 just check out generated svg source it has too many redundant styles
Going to track this issue as part of #496.