spec-up-t 0.11.9 → 0.11.10
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/assets/js/edit-term-buttons.js +1 -1
- package/index.js +25 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
function editTermButtons() {
|
|
10
10
|
// find the definition list that is the next sibling of #terms-definitions
|
|
11
|
-
const termsDefinitions = document.querySelector('
|
|
11
|
+
const termsDefinitions = document.querySelector('.terms-and-definitions-list');
|
|
12
12
|
|
|
13
13
|
// Remove "./" or "/" from the beginning of a string and "/" at the end of the string
|
|
14
14
|
function cleanPath(path) {
|
package/index.js
CHANGED
|
@@ -203,6 +203,31 @@ module.exports = function(options = {}) {
|
|
|
203
203
|
anchorClassName: 'toc-anchor'
|
|
204
204
|
})
|
|
205
205
|
.use(require('@traptitech/markdown-it-katex'))
|
|
206
|
+
|
|
207
|
+
// Custom plugin to add class to <dl>
|
|
208
|
+
function addClassToDefinitionList(md) {
|
|
209
|
+
const originalRender = md.renderer.rules.dl_open || function (tokens, idx, options, env, self) {
|
|
210
|
+
return self.renderToken(tokens, idx, options);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
md.renderer.rules.dl_open = function (tokens, idx, options, env, self) {
|
|
214
|
+
tokens[idx].attrPush(['class', 'terms-and-definitions-list']);
|
|
215
|
+
return originalRender(tokens, idx, options, env, self);
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
md.use(addClassToDefinitionList);
|
|
220
|
+
|
|
221
|
+
// Example markdown to test the functionality
|
|
222
|
+
const markdown = `
|
|
223
|
+
Term 1
|
|
224
|
+
: Definition 1
|
|
225
|
+
|
|
226
|
+
Term 2
|
|
227
|
+
: Definition 2
|
|
228
|
+
`;
|
|
229
|
+
|
|
230
|
+
console.log(md.render(markdown));
|
|
206
231
|
|
|
207
232
|
async function render(spec, assets) {
|
|
208
233
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.10",
|
|
4
4
|
"description": "Technical specification drafting tool that generates rich specification documents from markdown. Forked from https://github.com/decentralized-identity/spec-up by Daniel Buchner (https://github.com/csuwildcat)",
|
|
5
5
|
"main": "./index",
|
|
6
6
|
"repository": {
|