Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline HTML rendering #64

Closed
edemaine opened this issue Aug 9, 2021 · 1 comment
Closed

Inline HTML rendering #64

edemaine opened this issue Aug 9, 2021 · 1 comment

Comments

@edemaine
Copy link
Owner

edemaine commented Aug 9, 2021

I've been trying out svgtiler in the context of a RevealJS presentation, and it's really nice to have the ASCII art in the source file and have it render automatically, similar to KaTeX/MathJax. Here's a proposed general system:

  • <div class="svgtiler-mapping-..." id="map1"> or perhaps <script type="...svgtiler-mapping..." id="map2"> for specifying .txt, .js, .coffee mappings
  • <div class="svgtiler-drawing" data-mapping="#map1,#map2"> for ASCII art (maybe other variants for CSV, TSV, etc.) that specifies which mappings to use (via CSS query).
  • API call like renderToDOM(document) that finds all of these, hides the mappings, and converts the drawings to inlined SVG. Parsing seems to work well when style="white-space: pre" is set, though may need to do some whitespace trimming (removal of indentation).
  • Maybe we also want the svgtiler CLI to support .html input? Output could also be .html in that case...
@edemaine
Copy link
Owner Author

A version of this is now in v2.1.0. I opted for a simpler API without a mapping registry, as we need to call svgtiler somewhere in code anyway, so specifying the mapping there too seems natural. So now just the drawings can be embedded in the HTML, while mappings need to be built in code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant