Skip to content

Commit

Permalink
Revert anchors links feature
Browse files Browse the repository at this point in the history
Anchor links are out of scope for this component. Anchor links are best
handled dynamically, for example with static HTML generators, or hand
-coded.

This reverts commit ff843b4.
  • Loading branch information
rg-wood committed Jul 6, 2024
1 parent ff843b4 commit 9579118
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vellum-doc",
"version": "0.6.0",
"version": "0.7.0",
"description": "A simple document web component for web publishing",
"main": "vellum-doc.js",
"module": "vellum-doc.js",
Expand Down
19 changes: 0 additions & 19 deletions src/vellum-doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,6 @@ export class VellumDocument extends LitElement {
})
}

anchorHeadings() {
this.headings.forEach(heading => {
const spacing = document.createTextNode(' ')
heading.append(spacing)

const anchor = document.createElement('a')
anchor.href = `#${heading.id}`
anchor.innerHTML = '#'
anchor.className = 'anchor'
anchor.title = heading.textContent ? heading.textContent : ''

heading.append(anchor)
})
}

override render() {
return html`
<div id="sidebar">
Expand Down Expand Up @@ -141,10 +126,6 @@ export class VellumDocument extends LitElement {
html`<a href="#${id}">${heading}</a>`
)
}

override updated() {
this.anchorHeadings()
}
}

declare global {
Expand Down

0 comments on commit 9579118

Please sign in to comment.