diff --git a/packages/content-handler/src/websites/github-handler.ts b/packages/content-handler/src/websites/github-handler.ts index f086f72d3..7ac64c3fb 100644 --- a/packages/content-handler/src/websites/github-handler.ts +++ b/packages/content-handler/src/websites/github-handler.ts @@ -35,7 +35,7 @@ export class GitHubHandler extends ContentHandler { if (twitterTitle && twitterTitleContent) { twitterTitle.setAttribute( 'content', - twitterTitleContent.replace(/GitHub - .*\//, '') + twitterTitleContent.replace(/GitHub - (.*?)\//, '') ) } diff --git a/packages/content-handler/test/github-handler.test.ts b/packages/content-handler/test/github-handler.test.ts new file mode 100644 index 000000000..16cbb12b3 --- /dev/null +++ b/packages/content-handler/test/github-handler.test.ts @@ -0,0 +1,32 @@ +import { GitHubHandler } from '../src/websites/github-handler' +import 'mocha' +import { expect } from 'chai' +import { parseHTML } from 'linkedom' + +describe('preParse', () => { + it('should update the title on the page', async () => { + const dom = parseHTML( + ` + +
+ + + +