Skip to content

Commit 24499e4

Browse files
committed
feat: add full test suite
1 parent e5164a5 commit 24499e4

File tree

19 files changed

+838
-218
lines changed

19 files changed

+838
-218
lines changed

.github/workflows/changelog.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# .github/workflows/changelog.yml
2+
name: Check Changelog
3+
4+
on:
5+
pull_request:
6+
types:
7+
- opened
8+
- synchronize
9+
- reopened
10+
branches:
11+
- main
12+
13+
jobs:
14+
check-changelog:
15+
name: Verify CHANGELOG.md update
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Fetch all history to compare changes
21+
22+
- name: Get changed files
23+
id: changed-files
24+
uses: tj-actions/changed-files@v44 # Use a dedicated action to get changed files
25+
with:
26+
files: CHANGELOG.md
27+
28+
- name: Check if CHANGELOG.md was modified
29+
if: steps.changed-files.outputs.any_changed != 'true'
30+
run: |
31+
echo "Error: No changes detected in CHANGELOG.md."
32+
echo "Please update the CHANGELOG.md file with details about your changes."
33+
exit 1

.github/workflows/lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# .github/workflows/lint.yml
2+
name: Lint
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
stylua:
12+
name: Check Lua code style with stylua
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up stylua
18+
uses: JohnnyMorganz/stylua-action@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
# args: --check . # stylua action runs check by default
22+
23+
- name: Run lint check via Makefile
24+
run: make lint # Use Makefile target

.github/workflows/test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# .github/workflows/test.yml
2+
name: Test
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
test:
12+
name: Run tests
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Neovim
18+
uses: rhysd/action-setup-vim@v1
19+
with:
20+
neovim: true
21+
version: stable # Or specify a version like 'v0.9.5'
22+
23+
- name: Run tests
24+
run: make test # Use Makefile target

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
.Trashes
1010
ehthumbs.db
1111
Thumbs.db
12+
13+
# Test dependencies
14+
plenary.nvim/

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [Unreleased]
1111

12+
### Added
13+
14+
- Added comprehensive test suite using `plenary.nvim`.
15+
16+
### Changed
17+
18+
- Updated `MarkdownCodeBlock` command to correctly handle visual selections, including multi-line selections and selections starting mid-line.
19+
1220
## [1.0.1] - 2025-05-05
1321

1422
### Added

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Makefile
2+
3+
# Prevent targets from conflicting with files of the same name
4+
.PHONY: test lint clean
5+
6+
# Default target (optional, runs if you just type 'make')
7+
default: test
8+
9+
# Run the test suite
10+
test:
11+
@echo "Running tests..."
12+
@./scripts/test
13+
14+
# Check Lua code style
15+
lint:
16+
@echo "Checking code style with stylua..."
17+
@stylua --check .
18+
19+
# Remove temporary test dependencies
20+
clean:
21+
@echo "Cleaning up test dependencies..."
22+
@rm -rf plenary.nvim

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# markdown-tools.nvim 🪄
1+
# markdown-tools.nvim 🪄
22

33
[![Lua](https://img.shields.io/badge/Lua-blue.svg?style=flat-square&logo=lua)](https://www.lua.org)
44
[![License](https://img.shields.io/github/license/magnusriga/markdown-tools.nvim?style=flat-square)](LICENSE)
5+
[![Neovim >= 0.8.0](https://img.shields.io/badge/Neovim-%3E%3D%200.8.0-blueviolet.svg?style=flat-square)](https://neovim.io/)
6+
[![CI Status](https://img.shields.io/github/actions/workflow/status/magnusriga/markdown-tools.nvim/lint.yml?branch=main&style=flat-square)](https://github.com/magnusriga/markdown-tools.nvim/actions)
57

68
> Enhancing your Markdown editing experience in Neovim with intuitive shortcuts and commands.
79
@@ -13,7 +15,7 @@ The markdown created, including the frontmatter, is compatible with [obsidian](h
1315

1416
## ✨ Features
1517

16-
- **📝 Template Creation:** Create new Markdown files from predefined templates using your choice of picker (`snacks`, `fzf-lua`, `telescope`). Automatically adds frontmatter with placeholders (e.g., `alias`, `tags`).
18+
- **📝 Template Creation:** Create new Markdown files from predefined templates, using picker `snacks`, `fzf-lua`, or `telescope`. Automatically adds configurable frontmatter with placeholders (e.g., `alias`, `tags`).
1719
- **🧱 Insert Markdown Elements:** Quickly add links, checkboxes, tables, headers, bold/italic/highlight text, code blocks, ++.
1820
- **🎨 Visual Mode Integration:** Wrap selected text with bold, italic, links, or highlights.
1921
- **✅ Checkbox Management:** Insert new checkboxes and toggle their state.

0 commit comments

Comments
 (0)