Skip to content

Commit

Permalink
Add text from code tags to item ids
Browse files Browse the repository at this point in the history
  • Loading branch information
rangelfinal committed Nov 16, 2023
1 parent 64d0969 commit 0e7c461
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/services/checklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,16 @@ const rehypeFormatCheckboxes: Plugin = () => (tree) =>
if (!checkbox.properties.id) {
checkbox.properties.id = generateSlug(
elementsToBeWrappedInLabel
.map((text: any) => text.value)
.map((text: any) => {
if (text.value) return text.value;
if (text.children)
return text.children
.map((child: any) => child.value)
.filter(Boolean)
.join();
return "";
})
.filter(Boolean)
.join(),
);
}
Expand Down

0 comments on commit 0e7c461

Please sign in to comment.