add popups window with link
The markup element strips some HTML tags from the output. It is much better to just use the following code.

$attr = [
 'attributes' =&gt; [
   'class' =&gt; ['use-ajax'],
   'data-dialog-type' =&gt; 'modal',
   'data-dialog-options' =&gt; Json::encode([
     'width' =&gt; 700,
   ]),
 ]
];
$link = Link::createFromRoute($average, 'resume.grade_detail', ['uid' =&gt; $id, 'courseid' =&gt; $courseid], $attr);

return $link-&gt;toRenderable();