Skip to content

Commit

Permalink
Merge pull request #155 from Abhinavpatel00/patch-1
Browse files Browse the repository at this point in the history
Update TOCInline.tsx
  • Loading branch information
timlrx authored Mar 31, 2024
2 parents 00fc285 + fe3f1eb commit 5931687
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/pliny/src/ui/TOCInline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface TOCInlineProps {
exclude?: string | string[]
collapse?: boolean
ulClassName?: string
liClassName?: string
}

export interface NestedTocItem extends TocItem {
Expand Down Expand Up @@ -57,6 +58,7 @@ const createNestedList = (items: TocItem[]): NestedTocItem[] => {
* exclude = '',
* collapse = false,
* ulClassName = '',
* liClassName = '',
* }
*
*/
Expand All @@ -68,6 +70,7 @@ const TOCInline = ({
exclude = '',
collapse = false,
ulClassName = '',
liClassName = '',
}: TOCInlineProps) => {
const re = Array.isArray(exclude)
? new RegExp('^(' + exclude.join('|') + ')$', 'i')
Expand All @@ -86,7 +89,7 @@ const TOCInline = ({
return (
<ul className={ulClassName}>
{items.map((item, index) => (
<li key={index}>
<li key={index} className={liClassName}>
<a href={item.url}>{item.value}</a>
{createList(item.children)}
</li>
Expand Down

0 comments on commit 5931687

Please sign in to comment.