Skip to content

Commit c30c57a

Browse files
authored
Fix GH issue append (#107 fixes #105)
2 parents 1e19a81 + 29aa895 commit c30c57a

File tree

5 files changed

+93
-87
lines changed

5 files changed

+93
-87
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55
Version must be kept in-sync between [`package.json`](package.json) and [`wxt.config.js`](wxt.config.ts).
66

77
## [Unreleased]
8+
### Fixed
9+
- Appending to GitHub issues was not being enhanced, now fixed. ([#105](https://github.com/diffplug/gitcasso/issues/105))
10+
811
## [1.0.0] - 2025-10-02
912
- Fix html escaping inside single-tick and double-tick code blocks.
1013
- Add syntax highlighting for github-style #number.

src/lib/enhancers/github/GitHubIssueAppendEnhancer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export class GitHubIssueAppendEnhancer
5959
const number = parseInt(numberStr!, 10)
6060
const unique_key = `github.com:${slug}:${number}`
6161
const title = document
62-
.querySelector("main h1")!
63-
.textContent.replace(/\s*#\d+$/, "")
62+
.querySelector("main h2")!
63+
.textContent!.replace(/\s*#\d+$/, "")
6464
.trim()
6565
return {
6666
domain: location.host,

tests/corpus/gh_issue.html

Lines changed: 82 additions & 79 deletions
Large diffs are not rendered by default.

tests/lib/enhancers/__snapshots__/gh-detection.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`github detection > gh_issue:should detect correct spots 1`] = `
44
[
55
{
6-
"for": "id=:rn: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
6+
"for": "id=:r2q: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
77
"spot": {
88
"domain": "github.com",
99
"number": 523,
@@ -32,7 +32,7 @@ exports[`github detection > gh_issue_edit:should detect correct spots 1`] = `
3232
"domain": "github.com",
3333
"number": 56,
3434
"slug": "diffplug/gitcasso",
35-
"title": "what about the draft?",
35+
"title": "Description",
3636
"type": "GH_ISSUE_APPEND",
3737
"unique_key": "github.com:diffplug/gitcasso:56",
3838
},
@@ -64,7 +64,7 @@ exports[`github detection > gh_issue_edit_multiple:should detect correct spots 1
6464
"domain": "github.com",
6565
"number": 3,
6666
"slug": "diffplug/testing-deletable",
67-
"title": "Test 3",
67+
"title": "Description",
6868
"type": "GH_ISSUE_APPEND",
6969
"unique_key": "github.com:diffplug/testing-deletable:3",
7070
},

tests/lib/enhancers/__snapshots__/gh-ui.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`github ui > gh_issue:should render correct UI elements 1`] = `
44
[
55
{
6-
"for": "id=:rn: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
6+
"for": "id=:r2q: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
77
"title": "[jvm] docs for VCR",
88
"upperDecoration": <React.Fragment>
99
<span
@@ -39,7 +39,7 @@ exports[`github ui > gh_issue_edit:should render correct UI elements 1`] = `
3939
},
4040
{
4141
"for": "id=:ra7: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
42-
"title": "what about the draft?",
42+
"title": "Description",
4343
"upperDecoration": <React.Fragment>
4444
<span
4545
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
@@ -81,7 +81,7 @@ exports[`github ui > gh_issue_edit_multiple:should render correct UI elements 1`
8181
},
8282
{
8383
"for": "id=:r5b: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
84-
"title": "Test 3",
84+
"title": "Description",
8585
"upperDecoration": <React.Fragment>
8686
<span
8787
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"

0 commit comments

Comments
 (0)