Source code more like markup

I feel like I’ve written about this before, but can’t seem to find it, so here goes.

Most source code today is basically still just a text file. Historically this has been good because it it makes things easy to edit, platform independent, etc. There has been some level of progress in making source contain more… shall we say, meta data, than in the past – for instance, the code commenting that visual studio allows is effectively xml that is commented out in the source.

But, it’s friggin 2012 now, and every document in digital form has some level of markup along with some form of viewer, so that more.. i hate to use the word “rich”, but it applies here… rich information can be presented. For example: MS word allows doing all kinds of crazy things with your documents, way beyond what the original concept of word processing envisioned. And of course a better example to use is HTML. A better example, because it is open (the source is always easily visible if needed), and uses open standards so that anyone who so desires can build a viewer (browser) to enable viewing the html code in a more human friendly form.

So: what if my c# source code document were actually an html document, instead of just pure text. What would this allow me to do? Imagine how helpful some of these things might be for developing with a team-

-Highlight a section of code to draw attention to it.

-Add a comment to a portion of code that you hover over to see.

-Or, click to go directly to a discussion about the code in your team/respository server

-OR, add an anchor to the code that you reference in a bug, so clicking the link inside the bug report will take your directly to that line in the code.

-Unique formatting, as simple as changing font sizes and colors, or even align certain portions of code in multiple columns in the same source file

-Enable tracking the edit history of the file, inside the same file (not sure if this makes sense or not)

-Create your own collection of bookmarks and/or todo notes directly in the code where they are needed, associated with your username so you can filter out and see just the ones your wish to see.

-Sticky Notes… right?

The way I envision this happening is using something very close to html (if not actually html), which can contain all kinds of extra markup but the end result of the document is to render some text… but in this case, instead of the text being meant for the human to read, it will be the actual source “output” of the document that is meant for the comiler to handle. The rest of the markup is there to support the developer and the team by adding human-friendly visualization, interactivity, and functionality.