Mixed-dimensional linked models of diffusion: mathematical analysis and stable finite element discretizations