@canopycanopycanopy/b-ber-grammar-media 3.0.8-nav.0 → 3.0.8-next.61
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/README.md +15 -4
- package/dist/index.js +2 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# b-ber-grammar-media
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Handles the `media` and `media-inline` pseudo-directives, which are build-target-aware aliases resolved before the MarkdownIt parse step. Rather than emitting HTML directly, this package performs a text substitution pass over the raw Markdown string: it finds each `media` or `media-inline` directive, looks up the corresponding entry in `state.media` (populated from the project's `media.yml` file), and replaces the directive with the correct concrete directive (e.g. `vimeo`, `audio`, `figure`) for the current build target. The substituted Markdown is then parsed normally by the rest of the grammar pipeline. This allows authors to write a single `media` directive and have it resolve to different embed types per build.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
|
+
Called by the Markdown rendering pipeline before MarkdownIt processing:
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import media from '@canopycanopycanopy/b-ber-grammar-media'
|
|
11
|
+
media.render(markdownString) // returns updated Markdown string
|
|
7
12
|
```
|
|
8
|
-
|
|
13
|
+
|
|
14
|
+
## Dev
|
|
15
|
+
|
|
9
16
|
```
|
|
17
|
+
npm test
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Tests are in `__tests__/index.test.js`.
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-grammar-media",
|
|
3
|
-
"version": "3.0.8-
|
|
3
|
+
"version": "3.0.8-next.61+2bbec564",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@babel/runtime-corejs3": "^7.10.5",
|
|
29
|
-
"@canopycanopycanopy/b-ber-lib": "3.0.8-
|
|
30
|
-
"@canopycanopycanopy/b-ber-logger": "3.0.8-
|
|
31
|
-
"@canopycanopycanopy/b-ber-shapes-directives": "3.0.8-
|
|
29
|
+
"@canopycanopycanopy/b-ber-lib": "3.0.8-next.61+2bbec564",
|
|
30
|
+
"@canopycanopycanopy/b-ber-logger": "3.0.8-next.61+2bbec564",
|
|
31
|
+
"@canopycanopycanopy/b-ber-shapes-directives": "3.0.8-next.61+2bbec564",
|
|
32
32
|
"lodash": "^4.17.21",
|
|
33
33
|
"tar": "^6.1.11"
|
|
34
34
|
},
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"url": "https://maxwellsimmer.com"
|
|
50
50
|
}
|
|
51
51
|
],
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "2bbec5643278f53becb0d2ba1f55edfe379d5587"
|
|
53
53
|
}
|