Skip to content

Commit

Permalink
Add example for global config default attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
zerodevx committed Aug 30, 2024
1 parent b27edd5 commit cf430a5
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions docs/advanced-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ Change the default template globally like so:
await super.load()
this.template = `
<style>:host { display: block; }</style>
<link rel="stylesheet" href="https://example.com/markdown-styles.css" />
<link rel="stylesheet" href="https://example.com/highlight-styles.css" />`
<link rel="stylesheet" href="path/to/markdown-styles.css" />
<link rel="stylesheet" href="path/to/highlight-styles.css" />`
}
})
</script>
Expand All @@ -120,6 +120,23 @@ Or force `light` (or `dark`) theme:
</script>
```

Or set default attributes:

<!-- prettier-ignore -->
```html
<script type="module">
import ZeroMd from 'https://cdn.jsdelivr.net/npm/zero-md@3'
customElements.define('zero-md', class extends ZeroMd {
async load() {
await super.load()
this.setAttribute('no-auto', '') // disable auto-render for all instances
this.setAttribute('no-shadow', '') // don't use shadow dom
}
})
</script>
```

#### Adding `marked` extensions

Layer additional [marked extensions](https://marked.js.org/using_advanced#extensions) you may need
Expand Down

0 comments on commit cf430a5

Please sign in to comment.