Your question practically contains the answer. This technique is called ***self-reference***. So the text is described as *self-referential*. This does not only occur in literature: > In the context of *language*, self-reference is used to denote a statement that refers to itself or its own referent. The most famous example of a self-referential sentence is the liar sentence: > * “This sentence is not true.” > > Self-reference is often used in a broader context as well. For instance, a picture could be considered self-referential if it contains a copy of itself > > [![enter image description here][1]][1] > > and ***a piece of literature could be considered self-referential if it includes a reference to the work itself***. ([plato.stanford.edu][2]) About the use of self-reference in literature, [Wikipedia][3] explains: > Self-reference occurs in literature and film ***when an author refers to his or her own work in the context of the work itself.*** Examples include Miguel de Cervantes' *Don Quixote*, Shakespeare's *A Midsummer Night's Dream* and *The Tempest and Twelfth Night*. As an aside, I will add that self-reference is closely related with *[metafiction][4]*: > Metafiction is a form of fiction which emphasises its own constructedness in a way that continually *reminds the audience to be aware they are reading or viewing a fictional work*. Metafiction is self-conscious about language, literary form, and story-telling, and ***works of metafiction directly or indirectly draw attention to their status as artifacts***. [1]: https://i.sstatic.net/4YFVP.gif [2]: https://plato.stanford.edu/entries/self-reference/ [3]: https://en.wikipedia.org/wiki/Self-reference [4]: https://en.wikipedia.org/wiki/Metafiction