@md-plugins/md-plugin-containers 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.
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
@@ -27,16 +27,16 @@ pnpm add @md-plugins/md-plugin-containers
27
27
  ### Basic Setup
28
28
 
29
29
  ```js
30
- import MarkdownIt from 'markdown-it';
31
- import { containersPlugin } from '@md-plugins/md-plugin-containers';
30
+ import MarkdownIt from 'markdown-it'
31
+ import { containersPlugin } from '@md-plugins/md-plugin-containers'
32
32
 
33
- const md = new MarkdownIt();
33
+ const md = new MarkdownIt()
34
34
  md.use(containersPlugin, {
35
35
  containers: [
36
36
  { type: 'note', defaultTitle: 'Note' },
37
37
  { type: 'warning', defaultTitle: 'Warning' },
38
38
  ],
39
- });
39
+ })
40
40
 
41
41
  const markdownContent = `
42
42
  :::note
@@ -46,11 +46,11 @@ This is a note.
46
46
  :::warning
47
47
  This is a warning!
48
48
  :::
49
- `;
49
+ `
50
50
 
51
- const renderedOutput = md.render(markdownContent);
51
+ const renderedOutput = md.render(markdownContent)
52
52
 
53
- console.log('Rendered Output:', renderedOutput);
53
+ console.log('Rendered Output:', renderedOutput)
54
54
  ```
55
55
 
56
56
  ### Example Output
@@ -86,7 +86,7 @@ md.use(containersPlugin, {
86
86
  { type: 'tip', defaultTitle: 'Tip' },
87
87
  { type: 'important', defaultTitle: 'Important' },
88
88
  ],
89
- });
89
+ })
90
90
  ```
91
91
 
92
92
  ## Advanced Usage
@@ -99,24 +99,24 @@ Override the default rendering logic for containers:
99
99
  md.use(containersPlugin, {
100
100
  containers: [{ type: 'note', defaultTitle: 'Note' }],
101
101
  render(tokens, idx) {
102
- const token = tokens[idx];
102
+ const token = tokens[idx]
103
103
  if (token.nesting === 1) {
104
104
  // Opening tag
105
- const title = token.info.trim() || 'Note';
106
- return `<div class="custom-note"><strong>${title}:</strong>\n`;
105
+ const title = token.info.trim() || 'Note'
106
+ return `<div class="custom-note"><strong>${title}:</strong>\n`
107
107
  } else {
108
108
  // Closing tag
109
- return `</div>\n`;
109
+ return `</div>\n`
110
110
  }
111
111
  },
112
- });
112
+ })
113
113
  ```
114
114
 
115
115
  ## Adding Titles
116
116
 
117
117
  Containers can include titles by default or allow custom titles to be specified:
118
118
 
119
- ```markdown
119
+ ```markup
120
120
  :::note Custom Note Title
121
121
  This is a custom note with a title.
122
122
  :::
@@ -135,7 +135,7 @@ Rendered Output:
135
135
 
136
136
  Containers can be nested if your rendering logic supports it:
137
137
 
138
- ```markdown
138
+ ```markup
139
139
  :::note Outer Note
140
140
  :::warning Inner Warning
141
141
  Be cautious!
package/dist/index.mjs CHANGED
@@ -6,9 +6,7 @@ function containersPlugin(md, containers, createContainer) {
6
6
  return;
7
7
  }
8
8
  if (typeof createContainer !== "function") {
9
- throw new Error(
10
- "Invalid createContainer function provided to containersPlugin."
11
- );
9
+ throw new Error("Invalid createContainer function provided to containersPlugin.");
12
10
  }
13
11
  containers.forEach(({ type, defaultTitle }) => {
14
12
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@md-plugins/md-plugin-containers",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "A markdown-it plugin for handling custom containers.",
5
5
  "keywords": [
6
6
  "markdown-it",
@@ -36,7 +36,7 @@
36
36
  "@types/markdown-it": "^14.1.2",
37
37
  "markdown-it": "^14.1.0",
38
38
  "markdown-it-container": "^4.0.0",
39
- "@md-plugins/shared": "0.1.0-alpha.1"
39
+ "@md-plugins/shared": "0.1.0-alpha.2"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "scripts": {
48
48
  "build": "unbuild",
49
- "clean": "rm -rf dist",
49
+ "clean": "rm -rf dist/ node_modules/",
50
50
  "test": "vitest"
51
51
  }
52
52
  }