Skip to content

feat: add configurable options to copyOrDownloadAsMarkdownButtons - #143

Open
LuoMingxiang wants to merge 1 commit into
okineadev:mainfrom
LuoMingxiang:feature/configurable-button
Open

feat: add configurable options to copyOrDownloadAsMarkdownButtons#143
LuoMingxiang wants to merge 1 commit into
okineadev:mainfrom
LuoMingxiang:feature/configurable-button

Conversation

@LuoMingxiang

Copy link
Copy Markdown

Description

This PR adds configurable options to the copyOrDownloadAsMarkdownButtons markdown-it plugin and keeps the existing string-based API backward compatible.

  • New showDownload option: allows hiding the 📥 Download as Markdown button.
  • New componentName option: customize the Vue component name injected after the first H1.
  • Export plugin options type CopyOrDownloadAsMarkdownButtonsPluginOptions from the package entry.
  • Internal cleanup: extracted the H1 injection logic into a helper, added missing JSDoc @param tags, and resolved lint warnings (no-shadow, max-statements, prefer-readonly-parameter-types).
  • Added tests in tests/markdown/markdown-it-plugins.test.ts covering default options, custom component name, showDownload toggle, missing H1, and multiple H1s.
  • Updated README with an options table and a usage example for { showDownload: false }.

Usage

import { defineConfig } from 'vitepress'
import { copyOrDownloadAsMarkdownButtons } from 'vitepress-plugin-llms'

export default defineConfig({
  markdown: {
    config(md) {
      md.use(copyOrDownloadAsMarkdownButtons, { showDownload: false })
    },
  },
})

… component name and download visibility; add tests for new functionality
@pkg-pr-new

pkg-pr-new Bot commented Aug 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/vitepress-plugin-llms@143

commit: edcebe2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant