@md-plugins/md-plugin-headers 0.1.0-alpha.1 → 0.1.0-alpha.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.
Files changed (3) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +8 -10
  3. package/package.json +3 -3
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2024-present, Jeff Galbraith
3
+ Copyright (c) 2024-present, MD-PLUGINS
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -109,17 +109,15 @@ With the `toc` property in `env`, you can build a ToC dynamically:
109
109
  function generateToC(toc) {
110
110
  const list = toc
111
111
  .map((item) => {
112
- const children = item.children
113
- ? `<ul>${generateToC(item.children)}</ul>`
114
- : '';
115
- return `<li><a href="${item.link}">${item.title}</a>${children}</li>`;
112
+ const children = item.children ? `<ul>${generateToC(item.children)}</ul>` : ''
113
+ return `<li><a href="${item.link}">${item.title}</a>${children}</li>`
116
114
  })
117
- .join('');
118
- return `<ul>${list}</ul>`;
115
+ .join('')
116
+ return `<ul>${list}</ul>`
119
117
  }
120
118
 
121
- const tocHtml = generateToC(env.toc);
122
- console.log('Generated ToC:', tocHtml);
119
+ const tocHtml = generateToC(env.toc)
120
+ console.log('Generated ToC:', tocHtml)
123
121
  ```
124
122
 
125
123
  ### Custom Slugify Function
@@ -129,7 +127,7 @@ You can use your own slugification logic for header IDs:
129
127
  ```js
130
128
  md.use(headersPlugin, {
131
129
  slugify: (str) => encodeURIComponent(str.replace(/\s+/g, '_')),
132
- });
130
+ })
133
131
  ```
134
132
 
135
133
  Whatever you use on the backend, should be the same logic on the frontend for slugification so that they match when using hash links.
@@ -141,7 +139,7 @@ Enable nested headers to include headers inside blockquotes or lists:
141
139
  ```js
142
140
  md.use(headersPlugin, {
143
141
  shouldAllowNested: true,
144
- });
142
+ })
145
143
  ```
146
144
 
147
145
  ## Testing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@md-plugins/md-plugin-headers",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "A markdown-it plugin for handling headers (H1-H6).",
5
5
  "keywords": [
6
6
  "markdown-it",
@@ -35,14 +35,14 @@
35
35
  "dependencies": {
36
36
  "@types/markdown-it": "^14.1.2",
37
37
  "markdown-it": "^14.1.0",
38
- "@md-plugins/shared": "0.1.0-alpha.1"
38
+ "@md-plugins/shared": "0.1.0-alpha.2"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "unbuild",
45
- "clean": "rm -rf dist",
45
+ "clean": "rm -rf dist/ node_modules/",
46
46
  "test": "vitest"
47
47
  }
48
48
  }