On the mastodon thread for Karl Voitâs Markdown is a disaster interview live in an hour https://toobnix.org/w/gXLXQqxf5MYg1NDF2Ua6oA <- hopefully the right link, watch the Mastodon / that interview thread,
Edit: Karl Voit Episode archive: https://communitymedia.video/w/i7G3W41S91Z1DyoQuoMswF
NB: CHAT ON #emacsconf on IRC during the peertube LIVE.
I suggested that because Common lispâs FORMAT uses single character-ish directives it was similar to markdownâs *, #, [..], - and so forth. And asked if someone could find McDermottâs http://cs-www.cs.yale.edu/homes/dvm/format-stinks.html .
Jack Daniel (McCLIM, Embeddable common lisp, (Mastodon)) dug it up for me.
Read the thread; we are not-quite-ubiquitously an org over MD crowd, though as Vassil Nikolov says, for worse or better markdown seems to be the lingua franca. Elias wrote good notes.
The wikipedia article above is very good. The only complete omission I noticed is ~@<newline>.
Anyway, I still wrote this note earlier. If you are unfamiliar with ~? and ~/pkg:thing/ it might help you. I "implement markdown" in it.
Letâs perform the common lisp beginnerâs exercise of formatting time output, in a way that clearly illustrates why people hate common lispâs formatted output.
#| my personal emacs setup.
⢠(setq inferior-lisp-program "ecl")
⢠(slime)
⢠(setq eepitch-buffer-name "*slime-repl ECL*")
|#
then
CL-USER> (format
t
"~{~{~:[~1*~^~;~1:*~a~a~]~}~^~1:*~{~:[~;, ~]~1*~}~}.~%"
'((8 am)
(0 UTC)
(Sunday 7th)
(nil "-th day")
(nil "-th day")
(foo bar)))
8AM, 0UTC, SUNDAY7TH, FOOBAR.
NIL
CL-USER>
Now, you do sometimes see or foolishly write these âline noiseâ oneliners. In my case, mine looks especially bad because it does-the-impossible.
The impossible thing is that I want to skip (any list) that begins with nil - (nil something), or otherwise print its first two elements. This would be well and good but after iterating through the list I need to know if I was âmeant toâ add a comma or not. Youâre meant to use escape upwards at the tail of iteration, not after the iteration finishes, like the dark magic I have invoked.
Format uses control characters (always with their meaning escaped/prefixed by a ~), which is basically what markdown does but without the escape tilde, so whether a character is a directive or not has to be inferred from context. I guess lisp also has iteration and conditional characters, which markdown doesnât.
My point is that markdown basically has character format directives. Another difference is that in markdown, a directive is written repeatedly to indicate its level **really strong**, whereas lisp formatted output uses prefix arguements between the tilde and control character: â~2dâ ("~d" with pad-2).
(format t "~@{~?~}" ; i.e. format everything that follows
"# *~a*~%" ; Markdown bold heading 1 of:
'("A sane lisp formatted output example to resemble markdown")
"~@(~a.~)~%" ; Add normal capitalisation and a full stop to
'("this is string is a sentence")
"~@(~@{~a~^ ~}.~)" ; Add normal capitalisation and a full stop
'(this list is also a sentence)) ; and spaces to âŹ
Iterating over format-this directives lets us write in the usual left-to-right, top-to-bottom way, rather than front-loading all the control directives, and then somehow matching up arguements to them. Both org-mode and markdown are written left to right and top to bottom.
A feature of ANSI CL is that the directive can be use this function on the stream and arguement and modifiers. Since Iâm arguing markdown resembles common lisp formatted output, letâs implement common lisp formatted output markdown by way of checking.
(uiop:define-package :md)
(defun md::|#|
(stream arg colon atsign &optional (depth 1))
"md::|#| is the admittedly annoying md for 'heading'.
Use with FORMATting ~2/md:#/ on arg '|something| to get
## Something
Adds the implied newline."
(format stream
"~,,v,'#a ~a~%"
depth ""
arg))
(export 'md::|#| :md)
CL-USER> (format t "~@{~?~}"
"~3/md:#/" '(foo)
"~2/md:#/" '(bar)
"~a~%"
'("A literal string
Possibly containing newlines.")
"~3/md:#/" '(baz))
### FOO
## BAR
A literal string
Possibly containing newlines.
### BAZ
NIL
CL-USER>
Well, I think I demonstrated common lispâs formatted output, and that markdownâs controls can be implemented like ~/md:#/ for markdownâs # in ANSI standard common lispâs formatted output control character directive language.
On reflection, markdown and ANSI common lispâs formatted output seem to be very different, even though both use single character directives.
A program that implements markdown is vanishingly small whereas an implementation of .org syntax is clearly a large and serious endeavour, not to speak of orgâs extensive functionalities.
There are approaches such as the common lisp org parser, cl-org-mode, or directly implementing emacs lisp sufficiently to use most of the emacs lisp org-mode package, such as Raminâs schemacs and akaberâs cl-el.
Another contrast is between ANSI CL and html on one hand as being the result of a standards committee process, whereas both orgmode and markdown are whatever orgmode and markdown are. The difficulty of implementing orgmode means there is mostly just the one emacs orgmode, closely developed with emacs itself,
whereas most web framework projects have their own extension (âflavorâ) of markdown as their particular needs overflow markdownâs #-for-heading, *bold*-for-bold-bold. (Such as my friend Aralâs https://kitten.small-web.org/ ).
Peertube Archive of Karl Voitâs episode: https://communitymedia.video/w/i7G3W41S91Z1DyoQuoMswF
https://toobnix.org/w/gXLXQqxf5MYg1NDF2Ua6oA HOPEFULLY THE RIGHT LINK INSTEAD WATCH THE THREAD
https://gamerplus.org/@screwlisp/115142459996919932
See you in 45 minutes everyone.
screwlisp proposes a toast