hexo-renderer-mdx 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +162 -162
- package/LICENSE +21 -21
- package/README.md +377 -377
- package/index.js +134 -134
- package/package.json +38 -38
- package/test-mdx.js +47 -47
package/CONTRIBUTING.md
CHANGED
|
@@ -1,162 +1,162 @@
|
|
|
1
|
-
# Contributing to hexo-renderer-mdx
|
|
2
|
-
|
|
3
|
-
Thank you for your interest in contributing! This document provides guidelines for contributing to the project.
|
|
4
|
-
|
|
5
|
-
## Getting Started
|
|
6
|
-
|
|
7
|
-
1. Fork the repository
|
|
8
|
-
2. Clone your fork:
|
|
9
|
-
```bash
|
|
10
|
-
git clone https://github.com/YOUR_USERNAME/hexo-renderer-mdx.git
|
|
11
|
-
cd hexo-renderer-mdx
|
|
12
|
-
```
|
|
13
|
-
3. Install dependencies:
|
|
14
|
-
```bash
|
|
15
|
-
npm install
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Development
|
|
19
|
-
|
|
20
|
-
### Running Tests
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm test
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
This runs both basic and advanced test suites that validate:
|
|
27
|
-
- MDX compilation
|
|
28
|
-
- Markdown rendering
|
|
29
|
-
- JSX element rendering
|
|
30
|
-
- Custom components
|
|
31
|
-
- Dynamic content
|
|
32
|
-
- Front matter handling
|
|
33
|
-
|
|
34
|
-
### Adding New Features
|
|
35
|
-
|
|
36
|
-
1. Create a new branch:
|
|
37
|
-
```bash
|
|
38
|
-
git checkout -b feature/your-feature-name
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
2. Make your changes to `index.js`
|
|
42
|
-
|
|
43
|
-
3. Add tests if applicable:
|
|
44
|
-
- Add test cases to `test/` directory
|
|
45
|
-
- Update `test.js` or `test-advanced.js` as needed
|
|
46
|
-
|
|
47
|
-
4. Run tests to ensure nothing is broken:
|
|
48
|
-
```bash
|
|
49
|
-
npm test
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
5. Commit your changes:
|
|
53
|
-
```bash
|
|
54
|
-
git add .
|
|
55
|
-
git commit -m "Add: your feature description"
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
6. Push to your fork:
|
|
59
|
-
```bash
|
|
60
|
-
git push origin feature/your-feature-name
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
7. Open a Pull Request
|
|
64
|
-
|
|
65
|
-
## Code Style
|
|
66
|
-
|
|
67
|
-
- Use single quotes for strings
|
|
68
|
-
- Use 2 spaces for indentation
|
|
69
|
-
- Add JSDoc comments for functions
|
|
70
|
-
- Follow existing code patterns
|
|
71
|
-
|
|
72
|
-
## Pull Request Guidelines
|
|
73
|
-
|
|
74
|
-
- Keep PRs focused on a single feature or fix
|
|
75
|
-
- Update documentation if needed
|
|
76
|
-
- Ensure all tests pass
|
|
77
|
-
- Add tests for new features
|
|
78
|
-
- Update README.md if adding user-facing changes
|
|
79
|
-
|
|
80
|
-
## Reporting Issues
|
|
81
|
-
|
|
82
|
-
When reporting issues, please include:
|
|
83
|
-
- Hexo version
|
|
84
|
-
- Node.js version
|
|
85
|
-
- hexo-renderer-mdx version
|
|
86
|
-
- Steps to reproduce
|
|
87
|
-
- Expected vs actual behavior
|
|
88
|
-
- Error messages (if any)
|
|
89
|
-
|
|
90
|
-
## Publishing (Maintainers Only)
|
|
91
|
-
|
|
92
|
-
### Setup - Trusted Publishing
|
|
93
|
-
|
|
94
|
-
This package uses **Trusted Publishing** (OIDC) for secure, token-free publishing to npm.
|
|
95
|
-
|
|
96
|
-
1. **Create an npm account** at https://www.npmjs.com if you don't have one
|
|
97
|
-
|
|
98
|
-
2. **Configure Trusted Publishing on npm**:
|
|
99
|
-
- Publish the package manually first time: `npm publish --access public`
|
|
100
|
-
- Go to https://www.npmjs.com/package/hexo-renderer-mdx/access
|
|
101
|
-
- Navigate to "Publishing" → "Trusted Publishers"
|
|
102
|
-
- Click "Add trusted publisher"
|
|
103
|
-
- Fill in the details:
|
|
104
|
-
- **Provider**: GitHub Actions
|
|
105
|
-
- **Repository owner**: Bryan0324
|
|
106
|
-
- **Repository name**: hexo-renderer-mdx
|
|
107
|
-
- **Workflow file**: publish.yml
|
|
108
|
-
- **Environment name**: (leave empty)
|
|
109
|
-
- Click "Add"
|
|
110
|
-
|
|
111
|
-
No npm tokens needed! The workflow uses OpenID Connect (OIDC) to authenticate securely.
|
|
112
|
-
|
|
113
|
-
### Publishing a New Version
|
|
114
|
-
|
|
115
|
-
1. **Update version** in `package.json`:
|
|
116
|
-
```bash
|
|
117
|
-
npm version patch # for bug fixes (1.0.0 → 1.0.1)
|
|
118
|
-
npm version minor # for new features (1.0.0 → 1.1.0)
|
|
119
|
-
npm version major # for breaking changes (1.0.0 → 2.0.0)
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
2. **Push changes and tags**:
|
|
123
|
-
```bash
|
|
124
|
-
git push
|
|
125
|
-
git push --tags
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
3. **Create a GitHub Release**:
|
|
129
|
-
- Go to https://github.com/Bryan0324/hexo-renderer-mdx/releases
|
|
130
|
-
- Click "Draft a new release"
|
|
131
|
-
- Choose the tag you just created
|
|
132
|
-
- Add release title (e.g., "v1.0.1")
|
|
133
|
-
- Add release notes describing changes
|
|
134
|
-
- Click "Publish release"
|
|
135
|
-
|
|
136
|
-
4. **GitHub Action will automatically**:
|
|
137
|
-
- Checkout the code
|
|
138
|
-
- Install dependencies
|
|
139
|
-
- Run tests
|
|
140
|
-
- Publish to npm with provenance using Trusted Publishing
|
|
141
|
-
- Make the package publicly available
|
|
142
|
-
|
|
143
|
-
5. **Verify publication**:
|
|
144
|
-
- Check https://www.npmjs.com/package/hexo-renderer-mdx
|
|
145
|
-
- Verify the new version is listed
|
|
146
|
-
- Check that provenance is displayed
|
|
147
|
-
|
|
148
|
-
### Manual Publishing (If Needed)
|
|
149
|
-
|
|
150
|
-
If you need to publish manually:
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
# Login to npm
|
|
154
|
-
npm login
|
|
155
|
-
|
|
156
|
-
# Publish
|
|
157
|
-
npm publish --access public
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## License
|
|
161
|
-
|
|
162
|
-
By contributing, you agree that your contributions will be licensed under the MIT License.
|
|
1
|
+
# Contributing to hexo-renderer-mdx
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing! This document provides guidelines for contributing to the project.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. Fork the repository
|
|
8
|
+
2. Clone your fork:
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/YOUR_USERNAME/hexo-renderer-mdx.git
|
|
11
|
+
cd hexo-renderer-mdx
|
|
12
|
+
```
|
|
13
|
+
3. Install dependencies:
|
|
14
|
+
```bash
|
|
15
|
+
npm install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Development
|
|
19
|
+
|
|
20
|
+
### Running Tests
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm test
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This runs both basic and advanced test suites that validate:
|
|
27
|
+
- MDX compilation
|
|
28
|
+
- Markdown rendering
|
|
29
|
+
- JSX element rendering
|
|
30
|
+
- Custom components
|
|
31
|
+
- Dynamic content
|
|
32
|
+
- Front matter handling
|
|
33
|
+
|
|
34
|
+
### Adding New Features
|
|
35
|
+
|
|
36
|
+
1. Create a new branch:
|
|
37
|
+
```bash
|
|
38
|
+
git checkout -b feature/your-feature-name
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. Make your changes to `index.js`
|
|
42
|
+
|
|
43
|
+
3. Add tests if applicable:
|
|
44
|
+
- Add test cases to `test/` directory
|
|
45
|
+
- Update `test.js` or `test-advanced.js` as needed
|
|
46
|
+
|
|
47
|
+
4. Run tests to ensure nothing is broken:
|
|
48
|
+
```bash
|
|
49
|
+
npm test
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
5. Commit your changes:
|
|
53
|
+
```bash
|
|
54
|
+
git add .
|
|
55
|
+
git commit -m "Add: your feature description"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
6. Push to your fork:
|
|
59
|
+
```bash
|
|
60
|
+
git push origin feature/your-feature-name
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
7. Open a Pull Request
|
|
64
|
+
|
|
65
|
+
## Code Style
|
|
66
|
+
|
|
67
|
+
- Use single quotes for strings
|
|
68
|
+
- Use 2 spaces for indentation
|
|
69
|
+
- Add JSDoc comments for functions
|
|
70
|
+
- Follow existing code patterns
|
|
71
|
+
|
|
72
|
+
## Pull Request Guidelines
|
|
73
|
+
|
|
74
|
+
- Keep PRs focused on a single feature or fix
|
|
75
|
+
- Update documentation if needed
|
|
76
|
+
- Ensure all tests pass
|
|
77
|
+
- Add tests for new features
|
|
78
|
+
- Update README.md if adding user-facing changes
|
|
79
|
+
|
|
80
|
+
## Reporting Issues
|
|
81
|
+
|
|
82
|
+
When reporting issues, please include:
|
|
83
|
+
- Hexo version
|
|
84
|
+
- Node.js version
|
|
85
|
+
- hexo-renderer-mdx version
|
|
86
|
+
- Steps to reproduce
|
|
87
|
+
- Expected vs actual behavior
|
|
88
|
+
- Error messages (if any)
|
|
89
|
+
|
|
90
|
+
## Publishing (Maintainers Only)
|
|
91
|
+
|
|
92
|
+
### Setup - Trusted Publishing
|
|
93
|
+
|
|
94
|
+
This package uses **Trusted Publishing** (OIDC) for secure, token-free publishing to npm.
|
|
95
|
+
|
|
96
|
+
1. **Create an npm account** at https://www.npmjs.com if you don't have one
|
|
97
|
+
|
|
98
|
+
2. **Configure Trusted Publishing on npm**:
|
|
99
|
+
- Publish the package manually first time: `npm publish --access public`
|
|
100
|
+
- Go to https://www.npmjs.com/package/hexo-renderer-mdx/access
|
|
101
|
+
- Navigate to "Publishing" → "Trusted Publishers"
|
|
102
|
+
- Click "Add trusted publisher"
|
|
103
|
+
- Fill in the details:
|
|
104
|
+
- **Provider**: GitHub Actions
|
|
105
|
+
- **Repository owner**: Bryan0324
|
|
106
|
+
- **Repository name**: hexo-renderer-mdx
|
|
107
|
+
- **Workflow file**: publish.yml
|
|
108
|
+
- **Environment name**: (leave empty)
|
|
109
|
+
- Click "Add"
|
|
110
|
+
|
|
111
|
+
No npm tokens needed! The workflow uses OpenID Connect (OIDC) to authenticate securely.
|
|
112
|
+
|
|
113
|
+
### Publishing a New Version
|
|
114
|
+
|
|
115
|
+
1. **Update version** in `package.json`:
|
|
116
|
+
```bash
|
|
117
|
+
npm version patch # for bug fixes (1.0.0 → 1.0.1)
|
|
118
|
+
npm version minor # for new features (1.0.0 → 1.1.0)
|
|
119
|
+
npm version major # for breaking changes (1.0.0 → 2.0.0)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
2. **Push changes and tags**:
|
|
123
|
+
```bash
|
|
124
|
+
git push
|
|
125
|
+
git push --tags
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
3. **Create a GitHub Release**:
|
|
129
|
+
- Go to https://github.com/Bryan0324/hexo-renderer-mdx/releases
|
|
130
|
+
- Click "Draft a new release"
|
|
131
|
+
- Choose the tag you just created
|
|
132
|
+
- Add release title (e.g., "v1.0.1")
|
|
133
|
+
- Add release notes describing changes
|
|
134
|
+
- Click "Publish release"
|
|
135
|
+
|
|
136
|
+
4. **GitHub Action will automatically**:
|
|
137
|
+
- Checkout the code
|
|
138
|
+
- Install dependencies
|
|
139
|
+
- Run tests
|
|
140
|
+
- Publish to npm with provenance using Trusted Publishing
|
|
141
|
+
- Make the package publicly available
|
|
142
|
+
|
|
143
|
+
5. **Verify publication**:
|
|
144
|
+
- Check https://www.npmjs.com/package/hexo-renderer-mdx
|
|
145
|
+
- Verify the new version is listed
|
|
146
|
+
- Check that provenance is displayed
|
|
147
|
+
|
|
148
|
+
### Manual Publishing (If Needed)
|
|
149
|
+
|
|
150
|
+
If you need to publish manually:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Login to npm
|
|
154
|
+
npm login
|
|
155
|
+
|
|
156
|
+
# Publish
|
|
157
|
+
npm publish --access public
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 grass-cat//Bryan0324
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 grass-cat//Bryan0324
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|