feat: support the plugin for multiple filetypes#5
Conversation
- 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>
There was a problem hiding this comment.
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
filetypesconfiguration 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", |
There was a problem hiding this comment.
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.
| pattern = M.config.filetypes or "markdown", | |
| pattern = M.config.filetypes, |
Description
A follow up for #3
Type of Change
Related Issues
Fixes #(issue number)
Testing
Checklist