export const getTagsFromElement = (doc) => {
    const nodes = Array.from(doc.querySelectorAll('*')).map(el => el.tagName);
    return nodes;
};
export const getLeafContentsFromElement = (doc) => {
    const nodes = Array.from(doc.querySelectorAll('*'))
        .filter((el, _) => {
        return el.children.length === 0;
    })
        .map(el => el.textContent || '');
    return nodes;
};
export const getLastChildElementAttribute = (attribute, doc) => {
    return getLastChildElement(doc)?.getAttribute(attribute) ?? '';
};
export const lastChildElementHasAttribute = (attribute, doc) => {
    return getLastChildElement(doc)?.hasAttribute(attribute) ?? false;
};
export function getLastChildElement(doc) {
    let lastElement = doc.lastElementChild;
    while (lastElement?.lastElementChild) {
        lastElement = lastElement.lastElementChild;
    }
    return lastElement;
}
//# sourceMappingURL=markdown-parser-utils.js.map