Thank you for your interest in contributing! π
- Use the bug report template
- Provide clear steps to reproduce
- Include Neovim version and OS details
- Check if the issue is already reported
- Use the feature request template
- Explain the use case clearly
- Describe expected behavior
- Consider backward compatibility
- Create a branch:
git checkout -b feature/your-feature - Make your changes
- Write tests: Add tests for new functionality (see Testing)
- Run quality checks:
make test && make lint && make format - Commit: Use clear, descriptive commit messages (see Commit Messages)
- Push:
git push origin feature/your-feature - Open a Pull Request: Use the PR template
Note: You can open issues and pull requests directly to this repository. No need to fork unless you prefer to work on your own copy first.
# Install Lua linter
luarocks install luacheck
# Install Lua formatter (via Homebrew on macOS)
brew install stylua
# Or via Cargo
cargo install stylua
# Install plenary.nvim for testing
# Add to your plugin manager or:
git clone https://github.com/nvim-lua/plenary.nvim \
~/.local/share/nvim/site/pack/vendor/start/plenary.nvimmarkdown-plus.nvim/
βββ lua/markdown-plus/
β βββ init.lua # Plugin entry point
β βββ types.lua # Type definitions (LuaCATS)
β βββ config/
β β βββ validate.lua # Configuration validation
β βββ headers/
β β βββ init.lua # Headers and TOC functionality
β βββ list/
β β βββ init.lua # List management
β βββ format/
β β βββ init.lua # Text formatting
β βββ links/
β β βββ init.lua # Link operations
β βββ utils.lua # Utility functions
βββ spec/
β βββ minimal_init.lua # Test environment setup
β βββ markdown-plus/ # Test suites
β βββ config_spec.lua
β βββ utils_spec.lua
β βββ list_spec.lua
β βββ headers_spec.lua
βββ plugin/
βββ markdown-plus.lua # Auto-command setup
- Formatting: We use StyLua with 120 char width, 2-space indent
- Naming: Use
snake_casefor functions and variables - Globals: Only use
vimglobal; define all other vars aslocal - Comments: Document complex logic and all public APIs
- Use LuaCATS annotations for all public functions
- Document parameters with
@param name type description - Document return values with
@return type description - Define types in
lua/markdown-plus/types.lua
Example:
---Parse a markdown header line
---@param line string The line to parse
---@return table|nil header_info Table with level and text, or nil if not a header
function M.parse_header(line)
-- Implementation
endTests are written using Busted with plenary.nvim.
---Test suite for your module
---@diagnostic disable: undefined-field
local your_module = require("markdown-plus.your_module")
describe("your module", function()
-- Setup before each test
before_each(function()
-- Create test buffer
buf = vim.api.nvim_create_buf(false, true)
vim.bo[buf].filetype = "markdown"
vim.api.nvim_set_current_buf(buf)
end)
-- Cleanup after each test
after_each(function()
if vim.api.nvim_buf_is_valid(buf) then
vim.api.nvim_buf_delete(buf, { force = true })
end
end)
describe("function_name", function()
it("does something", function()
-- Test implementation
assert.are.equal(expected, actual)
end)
end)
end)# Run all tests
make test
# Run tests with coverage threshold checks
make test-coverage
# Run specific test file
make test-file FILE=spec/markdown-plus/your_spec.lua
# Watch for changes and auto-test (requires 'entr')
make test-watch
# Run linter
make lint
# Format code
make format
# Check formatting without modifying
make format-check- All public functions should have tests
- Test both success and error cases
- Test edge cases (empty input, nil values, etc.)
- CI enforces a minimum total line coverage threshold (85%)
- CI enforces a minimum threshold for critical files (80%)
Before submitting a PR, ensure:
# All tests pass
make test
# Expected: 34/34 tests passing
# Coverage thresholds pass
make test-coverage
# No linting errors
make lint
# Expected: 0 warnings / 0 errors
# Code is properly formatted
make format-check
# Expected: All files passWe follow Conventional Commits for automated releases.
<type>(<scope>): <description>
[optional body]
[optional footer]
feat: New feature (bumps MINOR version)fix: Bug fix (bumps PATCH version)docs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding or updating testschore: Maintenance tasksci: CI/CD changes
Add ! after type or BREAKING CHANGE: in footer to bump MAJOR version:
feat!: redesign configuration API
BREAKING CHANGE: Config structure changed
feat(headers): add support for setext headers
fix(list): correct variable reference in parse_list_line
test(config): add validation test cases
docs(readme): update development section with testing info
Note: Conventional commits are enforced on PRs via commitlint.
- All tests pass (
make test) - Code is linted (
make lint) - Code is formatted (
make format) - Added tests for new functionality
- Updated documentation if needed
- Follow conventional commit format (enforced by commitlint)
- No breaking changes (or clearly documented with
!orBREAKING CHANGE:)
- Clearly describe what the PR does
- Reference any related issues
- Include screenshots/GIFs for UI changes
- List any breaking changes
- Note any new dependencies
- Be open to feedback
- Respond to comments promptly
- Make requested changes
- Keep the PR focused and atomic
- Add LuaCATS type annotations to all public functions
- Document complex algorithms
- Explain non-obvious behavior
- Keep comments up-to-date
Update these files as needed:
README.md- User-facing features and usagedoc/markdown-plus.txt- Vim help documentation
Note: CHANGELOG.md is now auto-generated by release-please from conventional commits. See Releases.
Important: release-please appends new entries to the top of CHANGELOG.md and preserves existing content. Historical entries are not reformatted or changed.
This project uses release-please for automated releases.
- You commit using conventional format (e.g.,
feat: add feature) - Release-please creates/updates a release PR automatically
- Maintainer reviews and merges the release PR
- Automated release happens: GitHub release + LuaRocks publish
- Use conventional commit format for PR titles (enforced via commitlint)
- CHANGELOG.md is auto-generated - don't edit it manually
- Version bumps are automatic based on commit types:
feat:β minor version bump (1.4.1 β 1.5.0)fix:β patch version bump (1.4.1 β 1.4.2)feat!:orBREAKING CHANGE:β major version bump (1.4.1 β 2.0.0)chore:,docs:,style:β no version bump
For detailed information, see the release-please documentation.
Our CI runs on every push and PR:
- Tests: Matrix testing on Ubuntu/macOS with Neovim stable/nightly
- Linting: Luacheck validation
- Formatting: StyLua compliance check
- Documentation: TODOs and markdown validation
All checks must pass before merging.
- Open an issue for discussion before starting major changes
- Ask questions in draft PRs
- Join discussions in existing issues
Please be respectful and constructive. We're all here to make this plugin better!
Contributors will be listed in:
- GitHub contributors page
- Release notes for their contributions
Thank you for contributing! π