This seems like a good fit for the generic directives/plugins syntax as well. For example:
@@@code[caption](filename.cpp:100){.class}
int main(){
return 0;
}
@@@
Or you could probably get away with the attribute syntax and run some post-processor to get the desired output:
``` {.class caption=filename.cpp linenumber=100}
int main(){
return 0;
}
```