I sometimes dream of a source code editor that would allow inline diagrams and nicele rendered documentation and or equations. This could apply to any language that has support for multiline comments.
For example, a code like this, (where md stands for markdown)
/*md
Square value of *any* type
* please remember to set to rocket on fire before launch!
*/
template<typename T>int square(T v) {
return v * v;
}
would render like:
Square value of any type
- please remember to set to rocket on fire before launch! + Edit
template<typename T>int square(T v) {
return v * v;
}
And a code like this (where the plantuml markup would be rendered by plantuml
/*md
Below is a diagram
*/
/*plantuml
@startuml
B *-- A
@enduml
*/
struct A {
}
struct B {
A a;
}
Would render like
Below is a diagram + Edit
struct A {
}
struct B {
A a;
}
Much of this is supported in Emacs Org-Mode using the tools provided by the Babel module. Org-Mode supports various formatting (bold, italics, etc.), inline images, and PlantUML themselves have a page on using PlantUML with Org-Mode.
Source blocks within Org-Mode can also be easily opened in a separate buffer where you get the full editing features of that language. Once the buffer is closed your changes are put back in the document.