Skip to content

Instantly share code, notes, and snippets.

@Efreak
Last active Dec 12, 2021
Embed
What would you like to do?
testing to-html
<style>.terminal{background:#ccc;padding:1em}</style>
<P>Setting style <code style="background:#ccc"> &lt;style&gt;.terminal{background:#ccc;padding:1em}&lt;/style&gt; </code> to show dark backgrounds and margins.</p>
<P>You should think about <a href="https://stackoverflow.com/a/54652367">background color detection</a>, there's only a few things you can try and <a href="https://gist.github.com/blueyed/c8470c2aad3381c33ea3">this one</a> worked for me. Background color should certainly be optional, as some terminals will replace colors (Putty, Termux and other terminals allow color themes that modify the 16-color colors available, though for 88-color the built-in colors are usually enough.).</p>
<P>You might also want to consider importing fonts from a cdn, too; <a href="https://github.com/wernight/powerline-web-fonts">this</a> might work.</p>
<pre class="terminal">
<span class="shell">&gt; </span><span class="cmd">uname</span> <span class="flag">-a</span>
Linux localhost 4.14.190-22554634-abT860XXU4CUI4 #2 SMP PREEMPT Thu Sep 23 12:16:53 +07 2021 aarch64 Android
<span class="shell">&gt; </span><span class="caret"> </span>
</pre>
<pre class="terminal">
<span class="shell">&gt; </span><span class="cmd">neofetch</span>
<span style='color:#0a0'><b> -o o-
+hydNNNNdyh+
+mMMMMMMMMMMMMm+
`dMM<span style='color:#aaa'></span></b></span><b>m:</b><span style='color:#0a0'><b>NMMMMMMN<span style='color:#aaa'></span></b></span><b>:m</b><span style='color:#0a0'><b>MMd`
hMMMMMMMMMMMMMMMMMMh
.. yyyyyyyyyyyyyyyyyyyy ..
.mMMm`MMMMMMMMMMMMMMMMMMMM`mMMm.
:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:
:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:
:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:
:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM:
-MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM-
+yy+ MMMMMMMMMMMMMMMMMMMM +yy+
mMMMMMMMMMMMMMMMMMMm
`/++MMMMh++hMMMM++/`
MMMMo oMMMM
MMMMo oMMMM
oNMm- -mMNs</b></span>
<b><span style='color:#0a0'>u0_a1429</span></b>@<span style='color:#0a0'><b>localhost</b></span>
------------------
<span style='color:#0a0'><b>OS</b></span>: Android 11 aarch64
<span style='color:#0a0'><b>Host</b></span>: samsung SM-T860
<span style='color:#0a0'><b>Kernel</b></span>: 4.14.190-22554634-abT860XXU4CUI4
<span style='color:#0a0'><b>Uptime</b></span>: 10 days, 2 hours, 25 mins
<span style='color:#0a0'><b>Packages</b></span>: 478 (dpkg), 1 (pkg)
<span style='color:#0a0'><b>Shell</b></span>: bash 5.1.12
<span style='color:#0a0'><b>CPU</b></span>: Qualcomm SM8150P (8) @ 1.785GHz
<span style='color:#0a0'><b>Memory</b></span>: 4059MiB / 7445MiB (54%)
<span style='color:#0a0'><b>Disk</b></span>: 5.5G / 5.8G (95%)
<span style='color:#0a0'><b>Local IP</b></span>: 192.168.0.57
<span style='color:#000'><span style='background:#000'> <span style='color:#a00'><span style='background:#a00'> <span style='color:#0a0'><span style='background:#0a0'> <span style='color:#a60'><span style='background:#a60'> <span style='color:#00a'><span style='background:#00a'> <span style='color:#a0a'><span style='background:#a0a'> <span style='color:#0aa'><span style='background:#0aa'> <span style='color:#aaa'><span style='background:#aaa'> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span style='color:#000'><span style='background:#000'> <span style='color:#a00'><span style='background:#a00'> <span style='color:#0a0'><span style='background:#0a0'> <span style='color:#a60'><span style='background:#a60'> <span style='color:#00a'><span style='background:#00a'> <span style='color:#a0a'><span style='background:#a0a'> <span style='color:#0aa'><span style='background:#0aa'> <span style='color:#aaa'><span style='background:#aaa'> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span style='color:#555'><span style='background:#555'> <span style='color:#f55'><span style='background:#f55'> <span style='color:#5f5'><span style='background:#5f5'> <span style='color:#ff5'><span style='background:#ff5'> <span style='color:#55f'><span style='background:#55f'> <span style='color:#f5f'><span style='background:#f5f'> <span style='color:#5ff'><span style='background:#5ff'> <span style='color:#fff'><span style='background:#fff'> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span style='color:#555'><span style='background:#555'> <span style='color:#f55'><span style='background:#f55'> <span style='color:#5f5'><span style='background:#5f5'> <span style='color:#ff5'><span style='background:#ff5'> <span style='color:#55f'><span style='background:#55f'> <span style='color:#f5f'><span style='background:#f5f'> <span style='color:#5ff'><span style='background:#5ff'> <span style='color:#fff'><span style='background:#fff'> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span class="shell">&gt; </span><span class="caret"> </span>
</pre>
<pre class="terminal">
<span class="shell">&gt; </span><span class="cmd">to-html</span>
<b><span style='color:#a00'>error:</span></b> The following required arguments were not provided:
<b><span style='color:#a00'>&lt;command&gt;...</span></b>
USAGE:
to-html [FLAGS] [OPTIONS] &lt;command&gt;...
For more information try <span style='color:#0a0'>--help</span>
<span class="shell">&gt; </span><span class="caret"> </span>
</pre>
<pre class="terminal">
<span class="shell">&gt; </span><span class="cmd">to-html</span> <span class="flag">--help</span>
<span style='color:#0a0'>to-html</span> 0.1.2
Ludwig Stecher &lt;ludwig.stecher@gmx.de&gt;
Terminal wrapper that generates HTML from ANSI escape sequences
This requires that `bash` and `ansi-to-html` are installed.
<span style='color:#a60'>
USAGE:</span>
to-html [FLAGS] [OPTIONS] &lt;command&gt;...
<span style='color:#a60'>FLAGS:
</span> <span style='color:#0a0'>-c</span>, <span style='color:#0a0'>--cwd</span> Print the (abbreviated) current working directory in the command prompt
<span style='color:#0a0'>-d</span>, <span style='color:#0a0'>--doc</span> Output a complete HTML document, not just a &lt;pre&gt;
<span style='color:#0a0'>-h</span>, <span style='color:#0a0'>--help</span> Prints help information
<span style='color:#0a0'>-n</span>, <span style='color:#0a0'>--no-run</span> Don&#39;t run the commands, just emit the HTML for the command prompt
<span style='color:#0a0'>-V</span>, <span style='color:#0a0'>--version</span> Prints version information
<span style='color:#a60'>OPTIONS:
</span> <span style='color:#0a0'>-l</span>, <span style='color:#0a0'>--highlight</span> <span style='color:#0a0'>&lt;highlight&gt;</span><span style='color:#0a0'>...</span> Programs that have subcommands (which should be highlighted). Multiple arguments
are separated with a comma, e.g.
to-html -l git,cargo,npm &#39;git checkout main&#39;
<span style='color:#0a0'>-p</span>, <span style='color:#0a0'>--prefix</span> <span style='color:#0a0'>&lt;prefix&gt;</span> Prefix for CSS classes. For example, with the &#39;to-html&#39; prefix, the &#39;arg&#39; class
becomes &#39;to-html-arg&#39;
<span style='color:#0a0'>-s</span>, <span style='color:#0a0'>--shell</span> <span style='color:#0a0'>&lt;shell&gt;</span> The shell to run the command in. On macOS and FreeBSD, the shell has to support
`-c &lt;command&gt;`
<span style='color:#a60'>ARGS:
</span> <span style='color:#0a0'>&lt;command&gt;...</span> The command(s) to execute
<span class="shell">&gt; </span><span class="caret"> </span>
</pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment