metalsmith-markdown-partials 2.0.3 → 2.0.4
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/.nyc_output/{9d928c88-3cb5-4d77-8d43-36a76d50ab03.json → a0da4073-c568-4956-847a-81fd95f3459d.json} +0 -0
- package/.nyc_output/processinfo/{9d928c88-3cb5-4d77-8d43-36a76d50ab03.json → a0da4073-c568-4956-847a-81fd95f3459d.json} +1 -1
- package/.nyc_output/processinfo/index.json +1 -1
- package/README.md +58 -25
- package/package.json +1 -1
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":null,"pid":
|
|
1
|
+
{"parent":null,"pid":61877,"argv":["/Users/wernerglinka/.nvm/versions/node/v16.13.0/bin/node","/Users/wernerglinka/Documents/Projects/1-SANDBOXES/metalsmith-sandbox/>>>plugins/ms-markdown-partials/node_modules/.bin/mocha","./tests/index.js"],"execArgv":[],"cwd":"/Users/wernerglinka/Documents/Projects/1-SANDBOXES/metalsmith-sandbox/>>>plugins/ms-markdown-partials","time":1644605272274,"ppid":61876,"coverageFilename":"/Users/wernerglinka/Documents/Projects/1-SANDBOXES/metalsmith-sandbox/>>>plugins/ms-markdown-partials/.nyc_output/a0da4073-c568-4956-847a-81fd95f3459d.json","externalId":"","uuid":"a0da4073-c568-4956-847a-81fd95f3459d","files":["/Users/wernerglinka/Documents/Projects/1-SANDBOXES/metalsmith-sandbox/>>>plugins/ms-markdown-partials/lib/index.js"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"processes":{"
|
|
1
|
+
{"processes":{"a0da4073-c568-4956-847a-81fd95f3459d":{"parent":null,"children":[]}},"files":{"/Users/wernerglinka/Documents/Projects/1-SANDBOXES/metalsmith-sandbox/>>>plugins/ms-markdown-partials/lib/index.js":["a0da4073-c568-4956-847a-81fd95f3459d"]},"externalIds":{}}
|
package/README.md
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
# metalsmith-markdown-partials
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Metalsmith plugin that enables the use of Markdown partials.
|
|
4
4
|
|
|
5
5
|
[![metalsmith: plugin][metalsmith-badge]][metalsmith-url]
|
|
6
6
|
[![npm: version][npm-badge]][npm-url]
|
|
7
|
-
[![license:
|
|
7
|
+
[![license: ISC][license-badge]][license-url]
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
{#md "<file name>.md" #}
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
This allows for modular markdown and promotes reuse of markdown partials.
|
|
14
|
-
|
|
15
|
-
## Page Markdown File
|
|
16
|
-
|
|
17
|
-
A markdown file that will be transformed into an html file via a template
|
|
18
|
-
|
|
19
|
-
## Markdown Partial
|
|
20
|
-
|
|
21
|
-
A markdown file to be inserted into a Page Markdown file
|
|
22
|
-
|
|
23
|
-
Markdown partials are located in a separate directory, for example `/markdown-library/`. This directory should be located inside `/src/` .
|
|
24
|
-
|
|
25
|
-
Partial markdown files have the extention `.md`. A markdown partial file does NOT have frontmatter metadata, only the markdown to be inserted into a page markdown file.
|
|
26
|
-
|
|
27
|
-
The markdown partials directory's default location is `./src/markdown-library/`. The partials directory can be set via the libraryPath option.
|
|
9
|
+
Markdown fragments are be inserted into the contents of a page markdown file by replacing an include marker with markdown partials. This allows for modular markdown and promotes reuse of content.
|
|
28
10
|
|
|
29
11
|
## Installation
|
|
30
12
|
|
|
@@ -75,7 +57,27 @@ const mdPartials = require('metalsmith-markdown-partials').use(
|
|
|
75
57
|
|
|
76
58
|
## How it works
|
|
77
59
|
|
|
78
|
-
###
|
|
60
|
+
### Replacement marker
|
|
61
|
+
```
|
|
62
|
+
{#md "<file name>.md" #}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Page Markdown File
|
|
66
|
+
A markdown file that will be transformed into an html file via a template
|
|
67
|
+
|
|
68
|
+
### Markdown Partial
|
|
69
|
+
|
|
70
|
+
A markdown file to be inserted into a Page Markdown file
|
|
71
|
+
|
|
72
|
+
Markdown partials are located in a separate directory, for example `/markdown-library/`. This directory should be located inside `/src/` .
|
|
73
|
+
|
|
74
|
+
Partial markdown files have the extention `.md`. A markdown partial file does NOT have frontmatter metadata, only the markdown to be inserted into a page markdown file.
|
|
75
|
+
|
|
76
|
+
The markdown partials directory's default location is `./src/markdown-library/`. The partials directory can be set via the libraryPath option.
|
|
77
|
+
|
|
78
|
+
## Example
|
|
79
|
+
|
|
80
|
+
**index.md**
|
|
79
81
|
|
|
80
82
|
```markdown
|
|
81
83
|
# This is an Example Page
|
|
@@ -87,7 +89,7 @@ Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus
|
|
|
87
89
|
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
|
|
88
90
|
```
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
**example_partial.md**
|
|
91
93
|
|
|
92
94
|
```markdown
|
|
93
95
|
## Inserted Content
|
|
@@ -95,7 +97,7 @@ Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac fa
|
|
|
95
97
|
Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Nulla vitae elit libero, a pharetra augue.
|
|
96
98
|
```
|
|
97
99
|
|
|
98
|
-
|
|
100
|
+
**index.html**
|
|
99
101
|
|
|
100
102
|
```html
|
|
101
103
|
<h1>This is an Example Page</h1>
|
|
@@ -115,8 +117,39 @@ Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Nulla vitae
|
|
|
115
117
|
parturient montes, nascetur ridiculus mus.
|
|
116
118
|
</p>
|
|
117
119
|
```
|
|
120
|
+
## Debug
|
|
121
|
+
|
|
122
|
+
To enable debug logs, set the `DEBUG` environment variable to `metalsmith-markdown-partials`:
|
|
123
|
+
|
|
124
|
+
Linux/Mac:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
DEBUG=metalsmith-markdown-partials
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Windows:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
set "DEBUG=metalsmith-markdown-partials"
|
|
134
|
+
```
|
|
135
|
+
### CLI usage
|
|
136
|
+
|
|
137
|
+
To use this plugin with the Metalsmith CLI, add `metalsmith-markdown-partials` to the `plugins` key in your `metalsmith.json` file:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"plugins": [
|
|
142
|
+
{
|
|
143
|
+
"metalsmith-markdown-partials": {
|
|
144
|
+
"libraryPath": "./markdown-partials/",
|
|
145
|
+
"fileSuffix": ".md.njk"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
```
|
|
118
151
|
|
|
119
|
-
##
|
|
152
|
+
## Author
|
|
120
153
|
|
|
121
154
|
- [werner@glinka.co](https://github.com/wernerglinka)
|
|
122
155
|
|