Skip to content

feat: support the plugin for multiple filetypes#5

Merged
YousefHadder merged 3 commits intomainfrom
augustocdias/main
Oct 20, 2025
Merged

feat: support the plugin for multiple filetypes#5
YousefHadder merged 3 commits intomainfrom
augustocdias/main

Conversation

@YousefHadder
Copy link
Copy Markdown
Owner

Description

A follow up for #3

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Code refactoring
  • Performance improvement

Related Issues

Fixes #(issue number)

Testing

  • Tested manually
  • Added/updated tests (if applicable)

Checklist

  • Code follows project style
  • Self-reviewed my code
  • Commented complex logic
  • Updated documentation (if needed)
  • No new warnings generated

augustocdias and others added 3 commits October 20, 2025 10:57
- Fixed hardcoded filetype check in utils.is_markdown_buffer()
- Updated README.md with multi-filetype support documentation
- Updated doc/markdown-plus.txt with configuration examples
- Added new help tag *markdown-plus-configuration-filetypes*

The plugin now correctly activates for any configured filetype,
not just markdown. Users can specify filetypes in setup config:

  require('markdown-plus').setup({
    filetypes = { 'markdown', 'text', 'txt', 'note' },
  })

Resolves issue where plugin features were not working on non-markdown
files even when configured in the filetypes option.

Co-authored-by: Augusto César Dias <augusto.c.dias@gmail.com>
Copilot AI review requested due to automatic review settings October 20, 2025 18:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for configuring the markdown-plus plugin to work with multiple filetypes beyond just markdown. Users can now specify a list of filetypes in the configuration, allowing the plugin to work with plain text files, note-taking formats, and other text-based formats.

Key changes:

  • Added a new filetypes configuration option that accepts a list of filetypes
  • Updated the FileType autocmd to use the configured filetypes instead of hardcoded "markdown"
  • Deprecated the is_markdown_buffer() utility function to always return true since filetype filtering now happens at the autocmd level

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
lua/markdown-plus/init.lua Added filetypes config option and updated autocmd pattern to use it
lua/markdown-plus/utils.lua Deprecated is_markdown_buffer() function to always return true
README.md Added documentation and examples for configuring multiple filetypes
doc/markdown-plus.txt Added help documentation for the filetypes configuration option

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

vim.api.nvim_create_autocmd("FileType", {
group = group,
pattern = "markdown",
pattern = M.config.filetypes or "markdown",
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The fallback to 'markdown' will never be used because M.config.filetypes is initialized with { 'markdown' } on line 16. If the intent is to provide a fallback for when users explicitly set it to nil, this works, but the current default makes the fallback unreachable under normal circumstances.

Suggested change
pattern = M.config.filetypes or "markdown",
pattern = M.config.filetypes,

Copilot uses AI. Check for mistakes.
@YousefHadder YousefHadder merged commit c6406a0 into main Oct 20, 2025
@YousefHadder YousefHadder deleted the augustocdias/main branch October 20, 2025 18:22
@YousefHadder YousefHadder restored the augustocdias/main branch October 20, 2025 18:25
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.

3 participants