Use submodules instead of marking tricks for identifiers in docs.
Register scoped type variables for internal def. annotations.

Closes PR 13793.