Convert SVG to AsciiDoc
Max file size 100mb.
SVG vs AsciiDoc Format Comparison
| Aspect | SVG (Source Format) | AsciiDoc (Target Format) |
|---|---|---|
| Format Overview |
SVG
Scalable Vector Graphics
SVG is an XML-based vector image format for two-dimensional graphics, standardized by the W3C. It supports vector shapes, paths, text elements, CSS styling, JavaScript interactivity, animations, filters, and gradients. As a text-based format, SVG files can contain readable text content within text and tspan elements that can be extracted for conversion. Vector Graphics XML-Based |
AsciiDoc
AsciiDoc Markup Language
AsciiDoc is a comprehensive, human-readable markup language designed for writing technical documentation, articles, and books. It offers rich features including tables, lists, code blocks, cross-references, admonition blocks, and include directives. AsciiDoc can be converted to HTML, PDF, EPUB, and DocBook, making it a versatile format for technical publishing. Markup Language Documentation |
| Technical Specifications |
Structure: XML-based plain text with vector drawing elements
Encoding: UTF-8 (XML text format) Standard: W3C SVG 1.1 / SVG 2.0 (ISO/IEC 16509) MIME Type: image/svg+xml Extensions: .svg |
Structure: Plain text with AsciiDoc markup syntax
Encoding: UTF-8 Processors: Asciidoctor (Ruby, JS, Java), AsciiDoc.py Table Syntax: Pipe-delimited with |=== delimiters Extensions: .asciidoc, .adoc, .asc |
| Syntax Examples |
SVG stores text content in XML elements: <svg xmlns="http://www.w3.org/2000/svg">
<text x="10" y="30" font-size="20">
System Design
</text>
<text x="10" y="60">
<tspan x="10" dy="1.2em">Load Balancer</tspan>
<tspan x="10" dy="1.2em">Application Server</tspan>
<tspan x="10" dy="1.2em">Database Cluster</tspan>
</text>
</svg>
|
AsciiDoc uses structured headings and lists: = System Design * Load Balancer * Application Server * Database Cluster |
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
Introduced: 2001 (SVG 1.0 by W3C)
SVG 1.1: 2003 (Second Edition 2011) SVG 2.0: Candidate Recommendation (W3C) MIME Type: image/svg+xml |
Introduced: 2002 by Stuart Rackham
Asciidoctor: 2013 (Ruby-based processor) Status: Active development, growing adoption MIME Type: text/asciidoc |
| Software Support |
Web Browsers: Chrome, Firefox, Safari, Edge (native)
Editors: Inkscape, Adobe Illustrator, Figma Design Tools: Sketch, Affinity Designer, Gravit Libraries: D3.js, Snap.svg, SVG.js, Raphaël |
Asciidoctor: Primary processor (Ruby, JS, Java)
Editors: VS Code, IntelliJ, Atom with plugins Platforms: GitHub, GitLab, Antora Output: HTML, PDF, EPUB, DocBook, man pages |
Why Convert SVG to AsciiDoc?
Converting SVG to AsciiDoc enables you to extract text content from vector graphics and incorporate it into comprehensive documentation projects. SVG files frequently contain text labels, annotations, and descriptions within their text and tspan elements that are valuable for technical documentation.
A key advantage of this conversion is making graphical text content version-controllable. SVG files, while technically text-based, contain extensive XML markup for positioning and styling that makes diffs difficult to read. By extracting the text into AsciiDoc, every content change becomes clearly visible in commit histories.
AsciiDoc is one of the most powerful lightweight markup languages available, offering features that go beyond Markdown. Once your SVG text is in AsciiDoc format, you can leverage admonition blocks, cross-references, include directives, and table of contents generation to build comprehensive documentation from extracted content.
Our converter parses the SVG XML structure, extracts text content from text and tspan elements, and generates properly formatted AsciiDoc markup. The output is clean, readable AsciiDoc that can be directly processed by Asciidoctor into multiple output formats.
Key Benefits of Converting SVG to AsciiDoc:
- Text Extraction: Pull readable text from SVG vector graphic elements
- Rich Markup: AsciiDoc offers advanced features beyond simple Markdown
- Version Control: Track changes to extracted content in Git with meaningful diffs
- Multi-Format Output: Generate HTML, PDF, EPUB, and DocBook from a single source
- Modular Documentation: Use include directives to compose larger documents
- Publishing Pipeline: Directly usable in Asciidoctor-based workflows
Practical Examples
Example 1: Network Topology Diagram
Input SVG file (network.svg):
<svg xmlns="http://www.w3.org/2000/svg"> <text x="250" y="30" font-size="22">Network Topology</text> <text x="250" y="100">Internet Gateway</text> <text x="100" y="180">Firewall</text> <text x="250" y="260">Load Balancer</text> <text x="100" y="340">Web Server 1</text> <text x="400" y="340">Web Server 2</text> </svg>
Output AsciiDoc file (network.asciidoc):
= Network Topology * Internet Gateway * Firewall * Load Balancer * Web Server 1 * Web Server 2
Example 2: Process Flow Diagram
Input SVG file (process.svg):
<svg xmlns="http://www.w3.org/2000/svg">
<text x="200" y="25" font-size="20">CI/CD Pipeline</text>
<text x="50" y="80">
<tspan x="50" dy="1.4em">1. Code Commit</tspan>
<tspan x="50" dy="1.4em">2. Run Unit Tests</tspan>
<tspan x="50" dy="1.4em">3. Build Docker Image</tspan>
<tspan x="50" dy="1.4em">4. Deploy to Staging</tspan>
<tspan x="50" dy="1.4em">5. Integration Tests</tspan>
<tspan x="50" dy="1.4em">6. Deploy to Production</tspan>
</text>
</svg>
Output AsciiDoc file (process.asciidoc):
= CI/CD Pipeline . Code Commit . Run Unit Tests . Build Docker Image . Deploy to Staging . Integration Tests . Deploy to Production
Example 3: Feature Comparison Chart
Input SVG file (comparison.svg):
<svg xmlns="http://www.w3.org/2000/svg"> <text x="200" y="30" font-size="18">Plan Comparison</text> <text x="50" y="70">Basic Plan</text> <text x="200" y="70">Pro Plan</text> <text x="350" y="70">Enterprise Plan</text> <text x="50" y="100">5 GB Storage</text> <text x="200" y="100">50 GB Storage</text> <text x="350" y="100">Unlimited Storage</text> </svg>
Output AsciiDoc file (comparison.asciidoc):
= Plan Comparison * Basic Plan * Pro Plan * Enterprise Plan * 5 GB Storage * 50 GB Storage * Unlimited Storage
Frequently Asked Questions (FAQ)
Q: What is the difference between ADOC and AsciiDoc formats?
A: ADOC and AsciiDoc refer to the same markup language. The .adoc extension is the commonly used short form, while .asciidoc is the full-length extension. Both are processed identically by Asciidoctor and other AsciiDoc processors. The content and syntax are exactly the same.
Q: What text content is extracted from SVG files?
A: The converter extracts text content from SVG text and tspan elements. These are the XML elements that contain readable text in vector graphics, such as labels, annotations, titles, and descriptions. Visual-only elements like paths, shapes, and gradients are not converted.
Q: Are SVG visual elements preserved in the AsciiDoc output?
A: No. AsciiDoc is a text markup format and cannot represent vector shapes, paths, gradients, or animations. The converter focuses on extracting the textual content from SVG text elements. Visual design information is discarded during conversion.
Q: How does the converter handle SVG files with multiple text groups?
A: The converter processes all text and tspan elements across the entire SVG document, including those nested within groups (g elements). Text from all groups is extracted and organized sequentially in the AsciiDoc output.
Q: Can I process the output with Asciidoctor?
A: Yes, the generated AsciiDoc markup is fully compatible with Asciidoctor and can be rendered to HTML, PDF, EPUB, or DocBook. You can use include directives to incorporate the output into larger documentation projects.
Q: What happens to SVG JavaScript and interactivity?
A: JavaScript code, event handlers, and interactive elements in SVG files are not transferred to the AsciiDoc output. The conversion focuses exclusively on extracting static text content from the SVG document structure.
Q: Does the converter handle SVG files with embedded fonts?
A: The converter extracts the text content regardless of the font used in the SVG. Embedded fonts, web fonts, and system font references are part of the visual rendering and are not carried over. The text content itself is preserved accurately.
Q: Can I convert SVG files exported from design tools like Figma or Illustrator?
A: Yes. SVG files exported from any design tool (Figma, Adobe Illustrator, Inkscape, Sketch) that contain text elements will have their text content extracted. The converter works with standard SVG format regardless of the originating application.