Number paragraphs in a RTF or TXT document

Is it possible to use a script in order to number the paragraphs in a RTF or TXT document automatically – ideally also number only the paragraphs in a selection within such a document?

I’m thinking of a result like this:

I’m working with lots of texts from webpages that I drag and drop into DT. I discuss theses texts with students and it would be useful to be able to refer to certain paragraphs directly. Line numbers would be even better but would require much more reformatting, I suppose.

Thanks for any ideas.

A script is possible, but the standard RTF list styles in DEVONthink (or TextEdit, Bean, and so on) should already do what you want:

Select your text (the paragraphs you wish to number). Then open this menu from the RTF ruler in DEVONthink

and then choose Other… and configure it like below – note that you can include prefixes and suffixes around your numbers, and set the starting number.

and you get something that looks at lot like your spec

Thanks. Great idea. Works just as I wanted it to.