Fix prettier error

This commit is contained in:
Hongbo Wu
2022-11-16 10:34:52 +08:00
parent 3f69b42c05
commit c8febe900f
2 changed files with 264 additions and 5 deletions

View File

@ -12,7 +12,6 @@ export class GitHubHandler extends ContentHandler {
async preParse(url: string, dom: Document): Promise<Document> {
const body = dom.querySelector('body')
const head = dom.querySelector('head')
const article = dom.querySelector('article')
const twitterTitle = dom.querySelector(`meta[name='twitter:title']`)
const linkAuthor = dom.querySelector(`span[itemprop='author']`)
@ -34,7 +33,10 @@ export class GitHubHandler extends ContentHandler {
// Remove the GitHub - and repo org from the title
const twitterTitleContent = twitterTitle?.getAttribute('content')
if (twitterTitle && twitterTitleContent) {
twitterTitle.setAttribute('content', twitterTitleContent.replace(/GitHub - .*\//, ''))
twitterTitle.setAttribute(
'content',
twitterTitleContent.replace(/GitHub - .*\//, '')
)
}
return Promise.resolve(dom)