new DOMParser()
对象,我可以获取页面并使用以下代码获取markdown内容:function getPage(name, repo, file) {
fetch(`https://github.com/${name}/${repo}/${file}`, {mode: 'cors'})
.then(data => data.text())
.then(data => {
const parser = new DOMParser();
const dataEl = parser.parseFromString(data, "text/html");
const el = dataEl.querySelector(".wiki-body > .markdown-body")
$.html(".content", el.innerHTML)
})
}
getPage("arguiot", "Glottologist", "wiki")