-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interactive markdown #1304
base: main
Are you sure you want to change the base?
Interactive markdown #1304
Conversation
|
||
(defmacro with-constant-position ((point) &body body) | ||
"This allows you to move around the point without worry." | ||
`(let ((tmp (copy-point ,point))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you know of with-point(s)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to work the same, I will play around with it for a bit though and see if I can get it to work.
I tried to replace
(with-constant-position (point)
...)
with
(with-point ((point point))
...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't call delete-point for copy-point, the memory leaks.
What is your guys' opinions on adding a feature like this that allows custom post-processing:
The idea is that this could be added on to output formatted JSON, this could be used in any situation where the Downside is that it doesn't look pretty in a markdown renderer, although for default behavior it would change nothing. What are your thoughts? Edit: prototype here https://github.com/garlic0x1/lem/tree/block-metadata |
This adds interactive features to markdown code blocks, like how src blocks in org-mode work.
The API consists of 3 commands:
markdown-eval-block
,markdown-eval-block-and-insert
, andmarkdown-kill-block-result
, as well as one macro,register-block-evaluator
for users to add support for other languages (lisp and bash work by default).markdown-eval-block
evaluates the source block your cursor is in, and outputs the result to a popup buffer (just likelisp-macroexpand
)markdown-eval-block-and-insert
evaluates the block and inserts it's result below the block. If there was already a result there, it first deletes the old one.markdown-kill-block-result
deletes the result block below the code block your cursor is in, this is run automatically beforemarkdown-eval-block-and-insert
.If you try to evaluate a block and there is no registered evaluator, a message is displayed saying so. If you use any of these commands outside a code block, nothing happens. If you use these commands while not in markdown-mode, a warning is displayed.
Evaluation commands work asynchronously and you can do whatever you want while it is working.
Here is a demo:
Screencast from 2024-02-17 14-15-46.webm