Skip to content

Commit afa9388

Browse files
committed
Refactor ghOptions.ts and githubHighlighter.ts into github-common.ts.
1 parent 295d195 commit afa9388

File tree

7 files changed

+12
-17
lines changed

7 files changed

+12
-17
lines changed

src/lib/enhancers/github/ghOptions.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/lib/enhancers/github/githubHighlighter.ts renamed to src/lib/enhancers/github/github-common.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import hljs from 'highlight.js'
2+
import type { Options } from 'overtype'
23
import OverType from 'overtype'
34
import { oncePerRefresh } from '@/lib/once-per-refresh'
45

6+
export const commonGithubOptions: Options = {
7+
autoResize: true,
8+
lineHeight: 'var(--text-body-lineHeight-medium, 1.4285)',
9+
padding: 'var(--base-size-16)',
10+
}
11+
512
export function prepareGitHubHighlighter() {
613
oncePerRefresh('github-highlighter', () => {
714
OverType.setCodeHighlighter(githubHighlighter)

src/lib/enhancers/github/githubEditComment.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import type React from 'react'
33
import type { CommentEnhancer, CommentSpot, StrippedLocation } from '@/lib/enhancer'
44
import { logger } from '@/lib/logger'
55
import { modifyDOM } from '../modifyDOM'
6-
import { commonGithubOptions } from './ghOptions'
7-
import { prepareGitHubHighlighter } from './githubHighlighter'
6+
import { commonGithubOptions, prepareGitHubHighlighter } from './github-common'
87

98
export interface GitHubEditCommentSpot extends CommentSpot {
109
type: 'GH_EDIT_COMMENT'

src/lib/enhancers/github/githubIssueAddComment.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import type React from 'react'
44
import type { CommentEnhancer, CommentSpot, StrippedLocation } from '@/lib/enhancer'
55
import { logger } from '@/lib/logger'
66
import { modifyDOM } from '../modifyDOM'
7-
import { commonGithubOptions } from './ghOptions'
8-
import { prepareGitHubHighlighter } from './githubHighlighter'
7+
import { commonGithubOptions, prepareGitHubHighlighter } from './github-common'
98

109
export interface GitHubIssueAddCommentSpot extends CommentSpot {
1110
type: 'GH_ISSUE_ADD_COMMENT'

src/lib/enhancers/github/githubIssueNewComment.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import OverType, { type OverTypeInstance } from 'overtype'
22
import type { CommentEnhancer, CommentSpot, StrippedLocation } from '../../enhancer'
33
import { logger } from '../../logger'
44
import { modifyDOM } from '../modifyDOM'
5-
import { commonGithubOptions } from './ghOptions'
6-
import { prepareGitHubHighlighter } from './githubHighlighter'
5+
import { commonGithubOptions, prepareGitHubHighlighter } from './github-common'
76

87
interface GitHubIssueNewCommentSpot extends CommentSpot {
98
type: 'GH_ISSUE_NEW_COMMENT'

src/lib/enhancers/github/githubPRAddComment.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import type React from 'react'
33
import type { CommentEnhancer, CommentSpot, StrippedLocation } from '@/lib/enhancer'
44
import { logger } from '@/lib/logger'
55
import { modifyDOM } from '../modifyDOM'
6-
import { commonGithubOptions } from './ghOptions'
7-
import { prepareGitHubHighlighter } from './githubHighlighter'
6+
import { commonGithubOptions, prepareGitHubHighlighter } from './github-common'
87

98
export interface GitHubPRAddCommentSpot extends CommentSpot {
109
type: 'GH_PR_ADD_COMMENT' // Override to narrow from string to specific union

src/lib/enhancers/github/githubPRNewComment.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import OverType, { type OverTypeInstance } from 'overtype'
22
import type { CommentEnhancer, CommentSpot, StrippedLocation } from '../../enhancer'
33
import { logger } from '../../logger'
44
import { modifyDOM } from '../modifyDOM'
5-
import { commonGithubOptions } from './ghOptions'
6-
import { prepareGitHubHighlighter } from './githubHighlighter'
5+
import { commonGithubOptions, prepareGitHubHighlighter } from './github-common'
76

87
interface GitHubPRNewCommentSpot extends CommentSpot {
98
type: 'GH_PR_NEW_COMMENT'

0 commit comments

Comments
 (0)