TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Typograms: A definition and renderer for ASCII diagrams

162 pointsby sgotoalmost 2 years ago

20 comments

chrismorganalmost 2 years ago
&gt; <i>A polyfill is available that allows you use to use it in browsers.</i><p>This isn’t a polyfill. Polyfills are about implementing new native stuff on old environments, but no browser is going to be including this any time soon, and certainly not in this form—<p>&gt; <i>&lt;script type=&quot;text&#x2F;typogram&quot;&gt;</i><p>This should use &lt;pre&gt; instead, e.g. &lt;pre class=&quot;typogram&quot;&gt;. It’s content, not scripting, and if the JavaScript isn’t run (for whatever reason—JS is less reliable than people often think, especially third-party JS, even on environments that don’t try to block it) you’d like the diagram to still be visible in <i>some</i> form.<p>(Retaining the &lt;pre&gt; would also be a great improvement for selecting text—the current arrangement of “place single-character &lt;text&gt; elements” is almost useless for copy and paste (losing spaces and line breaks), which is the main reason I can imagine wanting such a thing. If character sizes and aspect ratios are a concern, control that stuff with scaling transforms or line-height, and detect and contain (e.g. &lt;span style=&quot;overflow:visible;width:…&quot;&gt;…&lt;&#x2F;span&gt;) individual characters that are falling out of the grid due to font fallback or bad ligatures like Nimbus Mono &lt;<a href="https:&#x2F;&#x2F;github.com&#x2F;ArtifexSoftware&#x2F;urw-base35-fonts&#x2F;issues&#x2F;31">https:&#x2F;&#x2F;github.com&#x2F;ArtifexSoftware&#x2F;urw-base35-fonts&#x2F;issues&#x2F;3...</a>&gt;.)
评论 #37052924 未加载
评论 #37058183 未加载
评论 #37071285 未加载
CRConradover 1 year ago
So this is basically just what we used to do in IBM Extended ASCII like thirty-five (forty?) years ago, only slightly expanded because Unicode has more characters than Codepage... Uh, 472? 185? I forget. But anyway, wow: So much time, so little progress.
jphalmost 2 years ago
Typograms could be great with the monodraw app on macOS. I&#x27;m a very happy customer of monodraw-- not affiliated in any way.<p><a href="https:&#x2F;&#x2F;monodraw.helftone.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;monodraw.helftone.com&#x2F;</a>
评论 #37049793 未加载
sgotoalmost 2 years ago
Previously submitted in personal repo:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=32133345">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=32133345</a><p>Now, officially open sourced:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;typograms">https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;typograms</a>
minhmeokealmost 2 years ago
Thank you, this looks really useful!<p>One more ASCII-based tool that you could add into your workflow is <a href="https:&#x2F;&#x2F;arthursonzogni.com&#x2F;Diagon&#x2F;#Sequence" rel="nofollow noreferrer">https:&#x2F;&#x2F;arthursonzogni.com&#x2F;Diagon&#x2F;#Sequence</a> which can be used to generate the ASCII that you input into Typogram.<p>For example, input:<p><pre><code> Renderer -&gt; Browser: BeginNavigation() Browser -&gt; Network: URLRequest() Browser &lt;- Network: URLResponse() Renderer &lt;- Browser: CommitNavigation() Renderer -&gt; Browser: DidCommitNavigation() </code></pre> will output the following sequence diagram:<p><pre><code> .--------. .-------. .-------. |Renderer| |Browser| |Network| &#x27;--------&#x27; &#x27;-------&#x27; &#x27;-------&#x27; | | | | BeginNavigation() | | |--------------------&gt;| | | | | | |URLRequest() | | |------------&gt;| | | | | |URLResponse()| | |&lt;------------| | | | | CommitNavigation() | | |&lt;--------------------| | | | | |DidCommitNavigation()| | |--------------------&gt;| | .--------. .-------. .-------. |Renderer| |Browser| |Network| &#x27;--------&#x27; &#x27;-------&#x27; &#x27;-------&#x27; </code></pre> and then you can perform further edits using something like <a href="https:&#x2F;&#x2F;asciiflow.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;asciiflow.com&#x2F;</a> (web, free) or <a href="https:&#x2F;&#x2F;ivanceras.github.io&#x2F;bob-editor&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;ivanceras.github.io&#x2F;bob-editor&#x2F;</a> (web, free) or <a href="https:&#x2F;&#x2F;monodraw.helftone.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;monodraw.helftone.com&#x2F;</a> (Mac only, proprietary) as mentioned in other comments.
评论 #37058060 未加载
akavelalmost 2 years ago
I&#x27;m somewhat confused: the &quot;Related&quot; section says:<p><i>&quot;[...] that motivated me to rewrite it [- presumably: svgbob -] in JS (svgbob is written in rust)&quot; [...]&quot;</i><p>So, is &quot;Typograms&quot; a modified rewrite of svgbob in JS? <i>IF</i> yes, isn&#x27;t it a Derivative Work of svgbob, and (per the Apache License, which seems to match the one used here) shouldn&#x27;t &quot;Typograms&quot; keep the mention of the original author somewhere in the Licensing information, and notably their original Copyright note? (As present e.g. in svgbob&#x27;s License file.)<p><i>IF NOT</i>, then why mention a &quot;rewrite&quot;? What is actual relation of Typograms to svgbob? This becomes even weirder given that some of the examples in the Typograms demo seem reused verbatim from the svgbob demo - but rendered poorer (at least on Firefox); making it sound like it is a rewrite also makes it sound like it is a - sorry for this - <i>crappy</i> rewrite... and this under google&#x27;s name... but then in the end is it actually <i>not</i> a rewrite? is it just a - still at first glance seemingly crappy, sorry - clone? (hm, at least I&#x27;d love to show some clearly highlighted improvements over svgbob, maybe? if I&#x27;m not to focus on the somewhat-broken parts of the demo?) aaaand still under google&#x27;s name?... reeeeaaaaaallllyyyyy wierd and confusing case to me... (O_o)
评论 #37054315 未加载
johnnyworkeralmost 2 years ago
As someone who is heavily biased against anything Google, the &quot;related work&quot; paragraph positively surprised me. I wish more software authors would point out alternatives in what I can only describe as a user friendly and generous manner.
评论 #37049753 未加载
评论 #37070990 未加载
layer8almost 2 years ago
Examples of actual typograms [0]: <a href="https:&#x2F;&#x2F;aaronkuehn.com&#x2F;art" rel="nofollow noreferrer">https:&#x2F;&#x2F;aaronkuehn.com&#x2F;art</a><p>[0] <a href="https:&#x2F;&#x2F;en.wiktionary.org&#x2F;wiki&#x2F;typogram" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wiktionary.org&#x2F;wiki&#x2F;typogram</a>
AndrewThrowawayalmost 2 years ago
So how do I easily draw? I can see potential to use it in documentation and etc but how do I create e.g. mock? Just typing all the symbols I need to remember?
评论 #37058104 未加载
评论 #37050446 未加载
Cockbrandalmost 2 years ago
Selecting text in the example diagrams somehow reminds me of Carpenter&#x27;s &quot;They Live&quot;, where the protagonist has glasses to see through the superficial appearance of people and billboards.<p>That said, I haven&#x27;t seen this or the mentioned related work before, and it&#x27;s really neat how easy it is to create good looking and very readable diagrams with this.
lachlan_grayalmost 2 years ago
This would combine really nicely with virtualedit=true in vim
评论 #37048163 未加载
kiitosalmost 2 years ago
ASCII diagrams can easily be drawn and maintained directly. That&#x27;s kind of the whole point! Generating them from some more primitive declaration language makes them harder to use, not easier. This kind of tool is frustrating.
评论 #37057886 未加载
评论 #37066081 未加载
lionkoralmost 2 years ago
Text clips on the top side on firefox android, which is quite embarrassing
评论 #37051432 未加载
badcppdevalmost 2 years ago
Cute.<p>But if the maintainer(?) is reading these comments it looks like the inductor in the circuit section isn&#x27;t working correctly. I can separate &quot;C&quot; characters rather than the normal circuit symbol
评论 #37058121 未加载
mdtrooperalmost 2 years ago
There is a lot of alternatives before of google, for example Ditaa <a href="https:&#x2F;&#x2F;github.com&#x2F;stathissideris&#x2F;ditaa">https:&#x2F;&#x2F;github.com&#x2F;stathissideris&#x2F;ditaa</a> .<p>There is a small list (in spanish) in: <a href="https:&#x2F;&#x2F;tomatesasesinos.com&#x2F;2020&#x2F;06&#x2F;11&#x2F;anti-nocodetools-diagramas&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;tomatesasesinos.com&#x2F;2020&#x2F;06&#x2F;11&#x2F;anti-nocodetools-diag...</a>
culialmost 2 years ago
shameless self plug of my very small collection of ascii data viz libraries<p><a href="https:&#x2F;&#x2F;ascii.dataviz.gallery&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;ascii.dataviz.gallery&#x2F;</a><p>planning to grow it soon with a more thorough breakdown of what libraries are available for what programming languages
评论 #37058111 未加载
评论 #37057818 未加载
avgcorrectionalmost 2 years ago
&gt; Typograms optimizes for editability and portability (e.g. plain text is easy to maintain, change, store and transmit), at the cost of expressivity (e.g. SVG is more expressive) and ergonomics (e.g. higher level tools produce diagrams faster).<p>How can it be both “easy to change” and not be ergonomic?
评论 #37057900 未加载
dolmenalmost 2 years ago
This reminds me I still have to learn Pikchr, the diagramming language used to render SQLite syntax diagrams.<p><a href="https:&#x2F;&#x2F;pikchr.org&#x2F;home&#x2F;doc&#x2F;trunk&#x2F;homepage.md" rel="nofollow noreferrer">https:&#x2F;&#x2F;pikchr.org&#x2F;home&#x2F;doc&#x2F;trunk&#x2F;homepage.md</a>
worthless-trashalmost 2 years ago
Its amazing, we can have thousands of emoticons, but not the more complex ascii to use for boxes.
评论 #37214566 未加载
blondinalmost 2 years ago
how would you export something like this to an image? and also, would this work in github markdown?