mirror of
https://github.com/dorny/test-reporter.git
synced 2026-02-04 21:47:56 +01:00
parent
6e6a65b7a0
commit
314ef1dd49
19 changed files with 667 additions and 664 deletions
|
|
@ -1,7 +1,9 @@
|
|||
// Returns HTML element id and href link usable as manual anchor links
|
||||
// This is needed because Github in check run summary doesn't automatically
|
||||
// create links out of headings as it normally does for other markdown content
|
||||
export function slug(name: string): {id: string; link: string} {
|
||||
import {ReportOptions} from '../report/get-report'
|
||||
|
||||
export function slug(name: string, options: ReportOptions): {id: string; link: string} {
|
||||
const slugId = name
|
||||
.trim()
|
||||
.replace(/_/g, '')
|
||||
|
|
@ -9,6 +11,7 @@ export function slug(name: string): {id: string; link: string} {
|
|||
.replace(/[^\w-]/g, '')
|
||||
|
||||
const id = `user-content-${slugId}`
|
||||
const link = `#${slugId}`
|
||||
// When using the Action Summary for display, links must include the "user-content-" prefix.
|
||||
const link = options.useActionsSummary ? `#${id}` : `#${slugId}`
|
||||
return {id, link}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue