mdat-plugin-example 1.0.0
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/dist/index.d.ts +8 -0
- package/dist/index.js +7 -0
- package/license.txt +21 -0
- package/package.json +63 -0
- package/readme.md +101 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/license.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Eric Mika
|
|
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.
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mdat-plugin-example",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Mdat rule plugin example template.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"markdown",
|
|
7
|
+
"mdat-plugin",
|
|
8
|
+
"mdat",
|
|
9
|
+
"npm-package"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/kitschpatrol/mdat-plugin-example",
|
|
12
|
+
"bugs": "https://github.com/kitschpatrol/mdat-plugin-example/issues",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/kitschpatrol/mdat-plugin-example.git"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Eric Mika",
|
|
20
|
+
"email": "eric@ericmika.com",
|
|
21
|
+
"url": "https://ericmika.com"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"module": "./dist/index.js",
|
|
32
|
+
"files": [
|
|
33
|
+
"dist/*"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"type-fest": "^5.2.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@kitschpatrol/shared-config": "^5.7.4",
|
|
40
|
+
"@types/node": "^20.19.24",
|
|
41
|
+
"bumpp": "^10.3.1",
|
|
42
|
+
"tsdown": "^0.15.12",
|
|
43
|
+
"typescript": "~5.9.3",
|
|
44
|
+
"vitest": "^4.0.6"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"mdat": "^1.1.0"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=20.19.0"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsdown --tsconfig tsconfig.build.json",
|
|
57
|
+
"clean": "git rm -f pnpm-lock.yaml ; git clean -fdX",
|
|
58
|
+
"fix": "ksc fix",
|
|
59
|
+
"lint": "ksc lint",
|
|
60
|
+
"release": "bumpp --commit 'Release: %s' && pnpm run build && NPM_AUTH_TOKEN=$(op read 'op://Personal/npm/token') && pnpm publish",
|
|
61
|
+
"test": "vitest --no-file-parallelism"
|
|
62
|
+
}
|
|
63
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<!--+ Warning: Content inside HTML comment blocks was generated by mdat and may be overwritten. +-->
|
|
2
|
+
|
|
3
|
+
<!-- title -->
|
|
4
|
+
|
|
5
|
+
# mdat-plugin-example
|
|
6
|
+
|
|
7
|
+
<!-- /title -->
|
|
8
|
+
|
|
9
|
+
<!-- badges -->
|
|
10
|
+
|
|
11
|
+
[](https://npmjs.com/package/mdat-plugin-example)
|
|
12
|
+
[](https://opensource.org/licenses/MIT)
|
|
13
|
+
|
|
14
|
+
<!-- /badges -->
|
|
15
|
+
|
|
16
|
+
<!-- short-description -->
|
|
17
|
+
|
|
18
|
+
**Mdat rule plugin example template.**
|
|
19
|
+
|
|
20
|
+
<!-- /short-description -->
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
_**This is an example plugin for the [mdat CLI tool](https://github.com/kitschpatrol/mdat), which is a simple Markdown templating system optimized for embedding dynamic content in repository readmes and the like.**_
|
|
25
|
+
|
|
26
|
+
Rule plugins are packages that export one or more mdat expansion rules.
|
|
27
|
+
|
|
28
|
+
This repository just provides a minimal example / project template for creating your own mdat plugins. See [mdat-plugin-tldraw](https://github.com/kitschpatrol/mdat-plugin-tldraw) and [mdat-plugin-cli-help](https://github.com/kitschpatrol/mdat-plugin-cli-help) for real-world examples.
|
|
29
|
+
|
|
30
|
+
If you just need a quick one-off rule specific to your project, you can define it directly in your `mdat.config.ts` file. A plugin repository is only necessary if you want to share the rule or use it across multiple projects.
|
|
31
|
+
|
|
32
|
+
_A high-level description of the plugin's functionality goes here._
|
|
33
|
+
|
|
34
|
+
## Getting started
|
|
35
|
+
|
|
36
|
+
### Dependencies
|
|
37
|
+
|
|
38
|
+
We'll assume you have [mdat](https://github.com/kitschpatrol/mdat) installed either globally or in your local project.
|
|
39
|
+
|
|
40
|
+
### Installation
|
|
41
|
+
|
|
42
|
+
Install the plugin as a development dependency:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pnpm add -D mdat-plugin-example
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Register the plugin in your mdat config file, e.g. `mdat.config.ts`:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import type { Config } from 'mdat'
|
|
52
|
+
import examplePlugin from 'mdat-plugin-example'
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
rules: {
|
|
56
|
+
...examplePlugin,
|
|
57
|
+
},
|
|
58
|
+
} satisfies Config
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
_A basic demonstration of the plugin's functionality goes here._
|
|
64
|
+
|
|
65
|
+
Assuming you have a `sketch.tldr` file in the root of your project, you can embed it in your Markdown file this:
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
<!-- example -->
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Then run the `mdat` CLI command on your Markdown file to expand the rule and embed the diagram:
|
|
72
|
+
|
|
73
|
+
```markdown
|
|
74
|
+
<!-- example -->
|
|
75
|
+
|
|
76
|
+
Hello from the [mdat](https://github.com/kitschpatrol/mdat) example plugin!
|
|
77
|
+
|
|
78
|
+
<!-- /example -->
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
_Any additional context, instructions, or examples go here._
|
|
82
|
+
|
|
83
|
+
## Maintainers
|
|
84
|
+
|
|
85
|
+
[@kitschpatrol](https://github.com/kitschpatrol)
|
|
86
|
+
|
|
87
|
+
<!-- contributing -->
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
[Issues](https://github.com/kitschpatrol/mdat-plugin-example/issues) and pull requests are welcome.
|
|
92
|
+
|
|
93
|
+
<!-- /contributing -->
|
|
94
|
+
|
|
95
|
+
<!-- license -->
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
[MIT](license.txt) © Eric Mika
|
|
100
|
+
|
|
101
|
+
<!-- /license -->
|