Interesting. I was thinking about something similar. I thought we can extract doc-strings and function source from any namespace and put them together in a string in MD format. Export in to a markdown file to read at leisure.
Do not break the syntax of any programming language, you can compile directly.
you only need a single line of regular replacement preprocessing, then you can use any Markdown parse or converter.
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.
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.
The most important thing is that my comment area markup method can be applied to any programming language and any markup (including Org,rst, asciidoc, etc.), which is the greatest advantage.
if you break the programming language syntax, like org, this is the biggest drawback.
Your project is good, but the main purpose of the Code comment area markup method is to live Preview directly in the Code Editor Preview panel without exporting or any preprocessing.
I think:
Literary Programming, Programming was the first, Literary was the second.
The entire file is compliant with the programming language syntax and can be compiled directly.
When writing (reading or refactoring) code files, I can modify and live preview directly in the editor without exporting or any preprocessing.
Do not interfere with people who do not understand the markup language to read the code.
Reliable. Maximum code accuracy is guaranteed, and markup language errors do not affect the code.
You could probably set this up with inotify and marginalia - so that each time you save your file it would regenerate the HTML and then it’d autorefresh in your browser window?
I’ve found running marginalia slow, so you’d need to find a way to speed things up by maybe having it run as some daemon
I do really like it’s side-by-side layout though and I use it in shorter programs where orgmode is overkill. And I do feel the layout is better than the traditional literate/org-mode vertical layout.
That all being said - I’ve never used live-preview while writing literate programs. I find that with the right highlighting it’s basically just as nice to stick to the raw text-form. Some emacs themes seem to extend org-mode’s highlighting so that it’s all visually easier to parse
So I feel the most pragmatic solution would just be a syntax highlighting layer on top of the existing Clojure one that would highlight the comment areas appropriately (which would be still written in a markdown/marginalia style). Something so it’s not all just light grey, but similar to the way text is highlighted in org, and then visually separate the code section with like a separate background or something to that effect. I think that’d get you 80% to where you want.
But the way things are right now, it’s a bit of an eyesore writing big grey code comment blocks
code comment area markup method can be in the editor preview panel live Preview, it’s fast.
Markdown is simple, so if it doesn’t have syntax highlighting, it doesn’t have much effect on writing and reading.
And having a gray comment area doesn’t affect reading code, especially for people who don’t understand the markup language.
Strict distinction between markdown and code, and markdown Gray, can reduce the amount of information in the source code file, conducive to reading code.
@geokon-gn Your method is document first, used to generate the document.
code comment area markup method is code first. used as a rich text code comments and Live Programming.
I love it! I adore literate programming, and ideas on this space are more of what we need. I really dig Marginalia, too. In my research, my favourite tool for readable documentation.
I had a go at my own LP tool a while back http://blaze.oat.sh/
Similar to Linpeng’s method, this just requires some frontmatter, for Blaze, its a shebang.
There are two schools of thought here: document-first (blaze), or code-first (Linpeng’s).
What I’d love to see is first-class literate support in Clojure, like the aforementioned coffeescript, and like haskell.
Perhaps a lein preprocessor plugin?