I have a series of free samples at my website:
These start from the most basic script possible and go into some fairly advanced topics. There is nothing specific about markers and cross-references, but these scripts should give you the basic idea, then you could come back here with more focused questions.
Note that the term "plugin" usually refers to an API client, not a script.
ExtendScript is a very powerful tool. I encourage you to continue this pursuit.