Skip to content

Add Lua filter support (pandoc.luaFilters) for admonition rendering#60

Merged
ChrisChinchilla merged 11 commits into
mainfrom
copilot/add-admonition-support
Mar 29, 2026
Merged

Add Lua filter support (pandoc.luaFilters) for admonition rendering#60
ChrisChinchilla merged 11 commits into
mainfrom
copilot/add-admonition-support

Conversation

Copilot AI commented Mar 9, 2026

Copy link
Copy Markdown

Docusaurus-style admonitions (::: note, :::warning, etc.) pass through Pandoc unprocessed because Pandoc has no built-in knowledge of that syntax. Pandoc's Lua filter mechanism is the correct extension point for this.

Changes

  • package.json: New pandoc.luaFilters setting — array of absolute paths to Lua filter files, default []
  • src/extension.ts: New getLuaFilters() reads the setting and builds --lua-filter="<path>" args; appended to the Pandoc command (both standard and Docker modes) only when non-empty
  • README.md: New "Lua Filters" section documenting the setting with a Docusaurus admonitions example
  • test/suites/extension.test.ts: New Lua Filters Tests suite — single filter, multiple filters, empty list, and render workflow integration cases

Usage

// .vscode/settings.json
{
  "pandoc.luaFilters": [
    "/path/to/admonition-filter.lua"
  ]
}

Produces: pandoc "doc.md" -o "doc.html" --lua-filter="/path/to/admonition-filter.lua"

This is intentionally general — any community or custom Lua filter works, not just admonition-specific ones.

Original prompt

This section details on the original issue you should resolve

<issue_title>Admonition support</issue_title>
<issue_description>I am using this extension with a Docusaurus project, and my markdown uses Admonitions. Unfortunately, those aren't rendering nicely.

Note that I am using Markdown Admonitions that adds support for Docusaurus style fenced divs to the markdown preview.</issue_description>

Comments on the Issue (you are @copilot in this section)

@ChrisChinchilla @whitford-olmst I wasn't aware this was something Pandoc could handle, especially from something that defines its own "standards", such as Docusaurus, but I will look into it… Though I can't promise it will actually be possible.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…tting)

Co-authored-by: ChrisChinchilla <42080+ChrisChinchilla@users.noreply.github.com>
Copilot AI changed the title [WIP] Add admonition support for Docusaurus markdown Add Lua filter support (pandoc.luaFilters) for admonition rendering Mar 9, 2026
@ChrisChinchilla
ChrisChinchilla marked this pull request as ready for review March 26, 2026 09:52
@promptless

promptless Bot commented Mar 26, 2026

Copy link
Copy Markdown

📝 Documentation updates detected!

New suggestion: Document Lua filter support for admonitions and document transformation


Tip: Planning a big docs refactor? Use Deep Analysis to get help with the heavy lifting 🔍

Comment thread src/extension.ts Fixed
…nstructed from library input

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread src/extension.ts Fixed
Comment thread src/extension.ts Fixed
Comment thread src/extension.ts Fixed
ChrisChinchilla and others added 2 commits March 29, 2026 09:47
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…, function or class

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Pandoc Lua filter support to the VS Code Pandoc extension, with the goal of enabling Docusaurus-style admonition rendering via Pandoc’s Lua filter mechanism (fixes #36).

Changes:

  • Adds pandoc.luaFilters configuration and threads resulting --lua-filter args into Pandoc invocation (native + Docker).
  • Introduces built-in admonition rendering via a bundled Lua filter and pandoc.enableAdmonitions.
  • Updates docs and extends the test suite around Lua filter behavior.

Reviewed changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tsconfig.json Updates TS module resolution and adds node/mocha types.
src/extension.ts Builds and appends --lua-filter arguments; adds built-in admonition filter toggle.
package.json Adds new settings; updates toolchain dependencies.
package-lock.json Locks updated dependency graph for toolchain version bumps.
README.md Documents Lua filters and new admonition support option.
test/suites/extension.test.ts Adds Lua filter/admonition-related tests.
filters/docusaurus-admonitions.lua New bundled Pandoc Lua filter implementing admonition rendering.
dist/extension.js Built output reflecting new extension behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
Comment thread filters/docusaurus-admonitions.lua
Comment thread README.md
Comment thread src/extension.ts
Comment thread src/extension.ts Outdated
Comment thread test/suites/extension.test.ts
Comment thread package.json
Comment thread filters/docusaurus-admonitions.lua
Comment thread filters/docusaurus-admonitions.lua
@ChrisChinchilla
ChrisChinchilla merged commit 34764fc into main Mar 29, 2026
4 of 11 checks passed
@promptless

promptless Bot commented Mar 29, 2026

Copy link
Copy Markdown

📝 Documentation updates detected!

Updated existing suggestion: Add release notes for Lua filter and admonition support


Tip: Adjust how proactive or focused Promptless is in Agent Settings ⚙️

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.

Admonition support

4 participants