appflowy-editor
appflowy-editor copied to clipboard
[FR] Diff variant for code block
Description
Hi, I''ve recently started to use AppFlowy, I use it as some sort of notes for learning, usually technical stuff. That brings me to the question, how to create a diff text/codeblock. With formatting, like in git, where lines with "+" sign at the beginning of the line have green color. and with "-" - red.
Example.
Is there any way to do that? Will it be implemented as separate codeblock language mode?
Impact
People who do coding notes like programmers, admins, devops, etc.
Additional Context
No response
The current CodeBlock plugin does not support this. I don't think something like this is being developed. But it could be a useful feature. It can be implemented as a separate mode, but it should be independent of language.
Currently the text inside codeblock is highlighted by the choice of the language and what keywords in the language are known.
We have to override this logic, saying if say Diff Variant mode is on, we color text followed by + in green and - by red and keep everything else white. It is certainly possible.
we color text followed by
+in green and-by red and keep everything else white.
To keep it even easier for you, there possibly additional condition, which will reduce false-positive coloring. That may be obvious for you, but I'll highlight it just in case.
As far as I have noticed (at least from using redmine), the line has to start with + or -, not just any +/- inside the line. So if the line starts with +/-, than that line only is colored. I may be wrong about "start with" condition and it may be not common logic for all diff blocks in all possible services, but seems reasonable.