Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier committed Aug 24, 2024
1 parent 5df19c5 commit e085738
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
9 changes: 1 addition & 8 deletions src/components/Search/SearchItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@ function SearchItem({ search, result }: SearchItemProps) {
>
<li className="px-2 py-1">
<div className="interactive-bg-surface-container-high flex items-center justify-between rounded-md p-4 py-5 transition-colors">
<div
className="break-all pr-3"
// dangerouslySetInnerHTML={{
// __html: `

// `,
// }}
>
<div className="break-all pr-3">
<div className="block pb-1 text-xs text-on-surface-variant/50">{result.label}</div>
<span
dangerouslySetInnerHTML={{
Expand Down
19 changes: 9 additions & 10 deletions src/components/mdx/Toc/rehypeToc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,18 @@ export const rehypeToc = (target: DocToC[] = [], url: string, page: string) => {
const id = slugify(title)
node.properties.id = id

// let siblingIndex = i + 1
// let sibling: Node | undefined = root.children[siblingIndex]
// while (sibling?.type === 'text') sibling = root.children[siblingIndex++]
// const description = sibling?.tagName === 'p' ? toString(sibling) : ''
//
// Extract content for each heading
//

let siblingIndex2 = i + 1
let siblingIndex = i + 1
const content: string[] = []
let sibling2: Node | undefined = root.children[siblingIndex2]
while (sibling2) {
if (RegExp(`^h${level}$`).test(sibling2.tagName)) break // stop at the next (same-level) heading
let sibling: Node | undefined = root.children[siblingIndex]
while (sibling) {
if (RegExp(`^h${level}$`).test(sibling.tagName)) break // stop at the next (same-level) heading

content.push(toString(sibling2))
sibling2 = root.children[siblingIndex2++]
content.push(toString(sibling))
sibling = root.children[siblingIndex++]
}

const item: DocToC = {
Expand Down

0 comments on commit e085738

Please sign in to comment.