Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit fe324c6

Browse files
committed
fix(plugins/plugin-client-common): restore anchors for code block
1 parent 958948c commit fe324c6

File tree

1 file changed

+19
-16
lines changed
  • plugins/plugin-client-common/src/components/Content/Markdown/components

1 file changed

+19
-16
lines changed

plugins/plugin-client-common/src/components/Content/Markdown/components/code.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,25 @@ export default function code(
8080
const statusConsideringReplay = !executed && (status === 'done' || status === 'error') ? 'replayed' : status
8181

8282
return (
83-
<Input
84-
readonly={false}
85-
className="kui--code-block-in-markdown"
86-
tab={mdprops.tab}
87-
value={body}
88-
language={language}
89-
blockId={attributes.id}
90-
validate={attributes.validate === '$body' ? body : attributes.validate}
91-
response={decodePriorResponse(attributes.response, attributes.responseEncoding)}
92-
status={statusConsideringReplay}
93-
arg1={body}
94-
arg2={language}
95-
arg3={myCodeIdx}
96-
onResponse={spliceCodeWithResponseFrontmatter}
97-
data-code-index={myCodeIdx}
98-
/>
83+
<React.Fragment>
84+
{attributes.id && <a id={`kui-link-${attributes.id}`} />}
85+
<Input
86+
readonly={false}
87+
className="kui--code-block-in-markdown"
88+
tab={mdprops.tab}
89+
value={body}
90+
language={language}
91+
blockId={attributes.id}
92+
validate={attributes.validate === '$body' ? body : attributes.validate}
93+
response={decodePriorResponse(attributes.response, attributes.responseEncoding)}
94+
status={statusConsideringReplay}
95+
arg1={body}
96+
arg2={language}
97+
arg3={myCodeIdx}
98+
onResponse={spliceCodeWithResponseFrontmatter}
99+
data-code-index={myCodeIdx}
100+
/>
101+
</React.Fragment>
99102
)
100103
} else {
101104
return (

0 commit comments

Comments
 (0)