In other words, Emacs has its own markup language? how does emacs know that a specific bit of text is a button, for example?
It's supported by text properties [1] and overlays [2]. Character properties are special attributes attached to a single character, while overlays can attach attributes to a "region" and override old text properties (like div in HTML).
In Emacs,
> A button is essentially a set of text or overlay properties, attached to a stretch of text in a buffer. [3]
The Emacs display engine is sorta like an HTML render engine.
[1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Te...
[2] https://www.gnu.org/software/emacs/manual/html_node/elisp/Ov...
[3] https://www.gnu.org/software/emacs/manual/html_node/elisp/Bu...