File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -257,6 +257,20 @@ export const MarkdownContent: FunctionComponent<MarkdownContentProps> = ({
257257 remarkRehypeOptions = { {
258258 // removes sr-only class from footnote labels applied by default
259259 footnoteLabelProperties : { className : [ '' ] } ,
260+ // omit default ↩ text; backref icon is rendered in LinkMessage
261+ footnoteBackContent : ( _referenceIndex , rereferenceIndex ) => {
262+ if ( rereferenceIndex > 1 ) {
263+ return [
264+ {
265+ type : 'element' ,
266+ tagName : 'sup' ,
267+ properties : { } ,
268+ children : [ { type : 'text' , value : String ( rereferenceIndex ) } ]
269+ }
270+ ] ;
271+ }
272+ return [ ] ;
273+ } ,
260274 ...reactMarkdownProps ?. remarkRehypeOptions
261275 } }
262276 disallowedElements = { disallowedElements }
Original file line number Diff line number Diff line change 33// ============================================================================
44
55import { Button , ButtonProps } from '@patternfly/react-core' ;
6- import { ExternalLinkSquareAltIcon } from '@patternfly/react-icons' ;
6+ import { RhMicronsExternalLinkIcon , RhUiBackwardsIcon } from '@patternfly/react-icons' ;
77import { ExtraProps } from 'react-markdown' ;
88import { css } from '@patternfly/react-styles' ;
99
10+ const isFootnoteBackref = ( className ?: string ) => className ?. includes ( 'data-footnote-backref' ) ;
11+
1012export interface LinkMessageProps {
1113 /** Flag indicating that the content should retain message styles when using Markdown. */
1214 shouldRetainStyles ?: boolean ;
@@ -26,7 +28,7 @@ const LinkMessage = ({
2628 component = "a"
2729 variant = "link"
2830 href = { href }
29- icon = { < ExternalLinkSquareAltIcon /> }
31+ icon = { < RhMicronsExternalLinkIcon /> }
3032 iconPosition = "end"
3133 isInline
3234 target = { target }
@@ -40,6 +42,23 @@ const LinkMessage = ({
4042 ) ;
4143 }
4244
45+ if ( isFootnoteBackref ( props . className ) ) {
46+ return (
47+ < Button
48+ isInline
49+ component = "a"
50+ href = { href }
51+ variant = "link"
52+ id = { id }
53+ icon = { < RhUiBackwardsIcon /> }
54+ { ...props }
55+ className = { css ( shouldRetainStyles && 'pf-m-markdown' , props ?. className ) }
56+ >
57+ { children }
58+ </ Button >
59+ ) ;
60+ }
61+
4362 return (
4463 // need to explicitly call this out or id doesn't seem to get passed - required for footnotes
4564 < Button
You can’t perform that action at this time.
0 commit comments