Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

exmarkdown-heading-anchor

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exmarkdown-heading-anchor

⚓️ A svelte-exmarkdown plugin that places anchors in heading tags

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
76
increased by1166.67%
Maintainers
1
Weekly downloads
 
Created
Source

exmarkdown-heading-anchor

npm-version npm-license npm-download-month npm-min-size ci.yml deploy.yml github-pages

⚓️ A svelte-exmarkdown plugin that places anchors in heading tags

Demo

Install

npm i exmarkdown-heading-anchor

This is plugin of svelte-exmarkdown. By using this plugin, convert Markdown as follows

# Heading1

## Heading2

### Heading3

<h1 id="Heading1">Heading1</h1>
<h2 id="Heading2">Heading2</h2>
<h3 id="Heading3">Heading3</h2>

This supports navigation by anchor links.

<a href="/path/to/page#Heading3">To Heading3</a>

Example

<script>
  import { headingAnchor } from 'exmarkdown-heading-anchor'
  import { Markdown } from 'svelte-exmarkdown'

  // ...
</script>

<Markdown
  md={/*...*/}
  plugins={[
    // ...
    headingAnchor({
      // Configuration (optional)
      /**
       * Character to prepend to ID to avoid collision
       * @default ''
       */
      prefix?: string

      /**
       * Tag to add ID attribute
       * @default ['h1', 'h2', 'h3']
       */
      include?: ('h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6')[]
    })
  ]}
/>

[!IMPORTANT]

Currently Limitations

The attribute is added when the component is mounted, so the HTML rendered server-side does not have an id attribute.

Keywords

FAQs

Package last updated on 10 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc