
[idea]Compatible code for Markdown literary programming - lincpa
Compatible code for Markdown literary programming. Just add a custom line comment character before each line of Markdown.<p>When previewing or converting a format, you only need to simply preprocess: replace the `\r\n\;` with `\r\n`
(note: line comment character of Clojure is `;`)<p>For example:<p>```<p>;# Markdown literary programming<p>;## example01:<p>;```clojure<p>(defn f [[evens odds total amax amin] x]<p><pre><code>  (let [[evens odds] (cond 

                       (even? x) [(inc evens ) odds]

                       (odd? x)  [evens (inc odds)]

                       :else     [evens odds])

        total (+ total x)

        amax  (max amax x)

        amin  (min amin x)]   

     [evens odds total amax amin]))
</code></pre>
(reduce f [0 0 0 ##-Inf ##Inf] [5 6 8 -3 -9 11 156 6 7])<p>;```<p>;`=&gt;[4 5 187 156 -9]`<p>```
======
brudgers
Curious if you are familiar with Emacs, org-mode, and Babel.

[https://orgmode.org/](https://orgmode.org/)

[https://orgmode.org/worg/org-contrib/babel/](https://orgmode.org/worg/org-
contrib/babel/)

~~~
lincpa
There are many editors that support markdown, and markdown is simpler, so you
can simply draw flowcharts, tables, task list, and display data visualizations
image in comments of code.

~~~
brudgers
I don't disagree. I'm biased toward Emacs because it supports so many
languages, from the mainstream like Clojure, Ruby, and Python to the niche
languages like Dot, PlantUML, and Standard ML.

What Babel+org-mode do for me is all the tangling and weaving of my literate
programs. It will handle the creation of multiple files from a single
document. For example I can create a literate document that includes leiningen
configuration, clojure source, a readme.md, and an HTML version of the
literate program document for Github pages all at once with a single command
(M-x org-babel-tangle). Within the document I have Emacs full suite of source
code tools: syntax highlighting, indentation, paredit, REPL's etc. for all the
different languages in my literate document.

Now all that comes with the caveat that I'm not really interested in writing
my own tangling and weaving tools for literate programming. Glue code to make
my workflow easier is enough. Of course, there was a point five or six years
ago when I mostly committed to the Emacs learning curve and a point two years
ago where I committed to Babel (as part of a commitment to more literate
programming).

What I find useful is that Emacs supports literate programming at a deeper
level than markdown.

Good luck.

~~~
lincpa
I mean, when we edit the code, we can preview the effect in real time. Editing
literary code has a live preview like most markdown editors.

The editor has a Live Preview panel to do the following work:

1\. Get the current text

2\. replace the `\r\n\;` with `\r\n` (note: line breaks and line comment
characters of the current file can be obtained from the editor’s API. line
comment characters of clojure(lisp) is `;`)

3\. live Preview markdown string

4\. Easily export directly to PDF or HTML.

Its advantages:

1\. Don't break the syntax of any programming language, you can compile
directly.

2\. you only need a single line of regular replacement preprocessing, then you
can use any Markdown parse or converter.

3\. Support any code editor that supports Markdwon Live preview, allowing the
source code of any programming language to become rich text in real time. In
the code's comment area, You can use the markdown to draw flowcharts, tables,
task lists, and display images on the live preview panel, enhance the
readability of your code.

4\. If you extend the Markdwon tag, you can implement the eval code, print
result, display data visualization and other instruction tags, to achieve live
programming, live test.

~~~
brudgers
Ah, I see. Thanks.

~~~
lincpa
comment area markup method can be applied to any programming language and any
markup (including Org,rst, asciidoc, etc.), which is the greatest advantage.
:-)

