Skip to content

Commit

Permalink
Merge pull request #13 from vintasoftware/fix/id-code-items
Browse files Browse the repository at this point in the history
Add text from code tags to item ids
  • Loading branch information
fjsj authored Nov 17, 2023
2 parents 58d45e9 + 0e7c461 commit 6b6b8a7
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 6b6b8a7

Please sign in to comment.