GitHub and DjangoBook like inline comments

Hey, guys.

I’m wondering how to implement comments like in GitHub ( pere line ) or
like DjangoBook ( per paragraph ).
The only thing I came with is parsing each file, split it to
lines/paragraphs and append div ids, but it looks like overhead. Also
I’ll have problems editing text file.

Any thoughts about how to implement such functionality ?

Thanks in advance,
Mitko K…