Kicks libsoldout with a default renderer, HTML output, but with a few soldout extensions allowed in the Markdown. The Unicon testhead also kicks firefox with the HTML encoded on the command line.
/* libsoldout markdown processor from Unicon*/#include<stdio.h>#include<soldout/markdown.h>#include<soldout/renderers.h>#include"icall.h"intsoldout(intargc,descriptorargv[]){structbuf*ib,*ob;descriptord;/* Need a string of markdown */if(argc<1)Error(103);ArgString(1);/* set up input and output buffers */ib=bufnew(strlen(StringVal(argv[1])));ob=bufnew(1024);bufputs(ib,StringVal(argv[1]));markdown(ob,ib,&nat_html);Protect(StringAddr(d)=alcstr(ob->data,ob->size),Error(306));argv->dword=(int)ob->size;argv->vword.sptr=StringAddr(d);//RetStringN(ob->data, (int)ob->size);bufrelease(ib);bufrelease(ob);return0;}
soldout.c
##-#Author:BrianTiffin#Dedicatedtothepublicdomain##Date:November2016#Modified:2016-11-11/04:30-0500##+##soldout.icn,aloadableMarkdowntoHTMLdemonstration##tectonics:#gcc-osoldout.so-shared-fpicsoldout.c-lsoldout#linkbase64proceduremain()markdown:="_ Unicon and libsoldout\n_ =====================\n_ \n_ ## Header 2\n_ ### Header 3\n_ - list item\n\n_ a link: <http://example.com> and `some code`\n\n_ and soldout extensions: ++insert++ --delete--"#loadupthesoldoutlibraryfunctionsoldout:=loadfunc("./soldout.so","soldout")write(markdown)write("\n---HTML markup follows---\n")#base64encodetheresultandpassthroughadataurlforbrowsingmarkup:=soldout(markdown)write(markup)system("firefox \"data:text/html;base64, "||base64encode(markup)||"\" &")end
soldout.icn
Sample run:
prompt$ gcc -o soldout.so -shared -fpic soldout.c -lsoldout
prompt$ unicon -s soldout.icn -x
Unicon and libsoldout
=====================
## Header 2
### Header 3
- list item
a link: <http://example.com> and `some code`
and soldout extensions: ++insert++ --delete--
---HTML markup follows---
<h1>Unicon and libsoldout</h1>
<h2>Header 2</h2>
<h3>Header 3</h3>
<ul>
<li>list item</li>
</ul>
<p>a link: <a href="http://example.com">http://example.com</a> and <code>some code</code></p>
<p>and soldout extensions: <ins>insert</ins> <del>delete</del></p>
libsoldout is in most distros now.
sudo apt install libsoldout1 libsoldout1-dev libsoldout-utils for Ubuntu.
Another alpha trial.
Kicks libsoldout with a default renderer, HTML output, but with a few soldout extensions allowed in the Markdown. The Unicon testhead also kicks firefox with the HTML encoded on the command line.
soldout.c
soldout.icn
Sample run:
libsoldout is in most distros now.
sudo apt install libsoldout1 libsoldout1-dev libsoldout-utils
for Ubuntu.http://fossil.instinctive.eu/libsoldout/home
The data URI scheme is kinda cool, passing webpages from the command line, ... almost as cool as libsoldout.
https://en.wikipedia.org/wiki/Data_URI_scheme
And a small shell script example to allow HTML files to be piped into firefox (or just about any browser that supports the data URI scheme):
Have good, make well,
Brian