@md-plugins/md-plugin-frontmatter 0.1.0-alpha.1 → 0.1.0-alpha.11

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/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
@@ -79,7 +79,7 @@ The `md-plugin-frontmatter` plugin supports the following options:
79
79
  | Option | Type | Default | Description |
80
80
  | ----------------- | ------- | ------- | ---------------------------------------------------------------------------------------------- |
81
81
  | grayMatterOptions | object | {} | Options for the gray-matter library. Refer to the gray-matter documentation. |
82
- | renderExcerpt | boolean | true | Whether to render the excerpt as HTML. If false, the raw Markdown is extracted as the excerpt. |
82
+ | renderExcerpt | boolean | false | Whether to render the excerpt as HTML. If false, the raw Markdown is extracted as the excerpt. |
83
83
 
84
84
  ## Advanced Usage
85
85
 
@@ -92,7 +92,7 @@ md.use(frontmatterPlugin, {
92
92
  grayMatterOptions: {
93
93
  delimiters: '+++', // Use "+++" as the frontmatter delimiter
94
94
  },
95
- });
95
+ })
96
96
  ```
97
97
 
98
98
  ## Testing
@@ -103,6 +103,10 @@ Run the unit tests with `Vitest` to ensure the plugin behaves as expected:
103
103
  pnpm test
104
104
  ```
105
105
 
106
+ ## Documentation
107
+
108
+ In case this README falls out of date, please refer to the [documentation](https://md-plugins.netlify.app/md-plugins/frontmatter/overview) for the latest information.
109
+
106
110
  ## License
107
111
 
108
112
  This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.
package/dist/index.d.mts CHANGED
@@ -15,7 +15,7 @@ interface FrontmatterPluginOptions {
15
15
  /**
16
16
  * Render the excerpt or not
17
17
  *
18
- * @default true
18
+ * @default false
19
19
  */
20
20
  renderExcerpt?: boolean;
21
21
  }
@@ -25,6 +25,10 @@ declare module '@md-plugins/shared' {
25
25
  * The raw Markdown content without frontmatter
26
26
  */
27
27
  content?: string;
28
+ /**
29
+ * Whether render excerpt or not
30
+ */
31
+ renderExcerpt?: boolean;
28
32
  /**
29
33
  * The excerpt that extracted by `md-plugin-frontmatter`
30
34
  *
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ interface FrontmatterPluginOptions {
15
15
  /**
16
16
  * Render the excerpt or not
17
17
  *
18
- * @default true
18
+ * @default false
19
19
  */
20
20
  renderExcerpt?: boolean;
21
21
  }
@@ -25,6 +25,10 @@ declare module '@md-plugins/shared' {
25
25
  * The raw Markdown content without frontmatter
26
26
  */
27
27
  content?: string;
28
+ /**
29
+ * Whether render excerpt or not
30
+ */
31
+ renderExcerpt?: boolean;
28
32
  /**
29
33
  * The excerpt that extracted by `md-plugin-frontmatter`
30
34
  *
package/dist/index.mjs CHANGED
@@ -1,10 +1,11 @@
1
1
  import grayMatter from 'gray-matter';
2
2
 
3
- const frontmatterPlugin = (md, { grayMatterOptions, renderExcerpt = true } = {}) => {
3
+ const frontmatterPlugin = (md, { grayMatterOptions, renderExcerpt = false } = {}) => {
4
4
  const render = md.render.bind(md);
5
5
  md.render = (src, env = {}) => {
6
6
  let data, content, excerpt;
7
7
  try {
8
+ ;
8
9
  ({ data, content } = grayMatter(src, grayMatterOptions));
9
10
  } catch (error) {
10
11
  console.error("Failed to parse frontmatter:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@md-plugins/md-plugin-frontmatter",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.11",
4
4
  "description": "A markdown-it plugin for handling frontmatter in markdown files.",
5
5
  "keywords": [
6
6
  "markdown-it",
@@ -33,17 +33,23 @@
33
33
  "./dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@types/markdown-it": "^14.1.2",
37
36
  "gray-matter": "^4.0.3",
38
37
  "markdown-it": "^14.1.0",
39
- "@md-plugins/shared": "0.1.0-alpha.1"
38
+ "@md-plugins/shared": "0.1.0-alpha.11"
39
+ },
40
+ "devDependencies": {
41
+ "@types/markdown-it": "^14.1.2"
42
+ },
43
+ "peerDependencies": {
44
+ "gray-matter": "^4.0.3",
45
+ "markdown-it": "^14.1.0"
40
46
  },
41
47
  "publishConfig": {
42
48
  "access": "public"
43
49
  },
44
50
  "scripts": {
45
51
  "build": "unbuild",
46
- "clean": "rm -rf dist",
52
+ "clean": "rm -rf dist/ node_modules/",
47
53
  "test": "vitest"
48
54
  }
49
55
  }