src/language-markdown/printer-markdown.js/getLastDescendantNode
function getLastDescendantNode(node) {
  let current = node;
  while (current.children && current.children.length !== 0) {
    current = current.children[current.children.length - 1];
  }
  return current;
}