I like this idea and brought it up with the Docs team last week. As a first pass, we already have the ability to show something is depreciated:
<!-- if version [lt 2.0] -->
Content only valid in versions before 2.0.
<!-- end version if -->
Semantically, that isn't quite the same thing since languages often discourage the use of features before yanking them away altogether. (It also lacks the punch of the red outline.) But since we aren't attempting to be the official Documentation I think it's ok to ignore that distinction. Think of it as less prescriptive and more descriptive. If a particular way of writing code is being replaced, it probably makes the most sense to show the new way first and then the outdated way with a little text warning:
That way, the example can provide a good deal of nuance between various approaches language designers take to depreciation:
- Tell people not to use the feature, but never really get around to removing it.
- Discourage use of a feature for a few versions with warnings then take it away.
- Remove the feature with minimal advanced notice.
- Maintain two separate branches.
A single depreciated syntax can't communicate all the variations without becoming less convenient than just using words.
That said, I can imagine some extra styling being added to older versions. Perhaps not vivid red as in the question, but maybe a lighter border. Or perhaps hiding the code block somehow. That would avoid adding syntax to inline versions while still getting the point across that using this bit of code might not be for everyone.
In any case, I'm declining the idea not because I think it flawed, but because it requires a little more thought to get right.
</vitriol>