@duetds/marked
Advanced tools
Comparing version 3.0.51 to 3.1.0
@@ -1,32 +0,27 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createDuetMarkedRenderer = void 0; | ||
var defaultOptions = { isExternalUrl: function () { return false; } }; | ||
const defaultOptions = { isExternalUrl: () => false }; | ||
/** | ||
* Creates a marked.js renderer that outputs Duet components | ||
*/ | ||
function createDuetMarkedRenderer(_a) { | ||
var _b = _a === void 0 ? defaultOptions : _a, isExternalUrl = _b.isExternalUrl; | ||
export function createDuetMarkedRenderer({ isExternalUrl } = defaultOptions) { | ||
return { | ||
heading: function (text, level) { | ||
return "<duet-heading level=\"h".concat(level, "\">").concat(text, "</duet-heading>"); | ||
heading(text, level) { | ||
return `<duet-heading level="h${level}">${text}</duet-heading>`; | ||
}, | ||
hr: function () { | ||
return "<duet-divider></duet-divider>"; | ||
hr() { | ||
return `<duet-divider></duet-divider>`; | ||
}, | ||
list: function (body, ordered) { | ||
var tag = ordered ? "ol" : "ul"; | ||
return "<".concat(tag, " class=\"duet-list\">").concat(body, "</").concat(tag, ">"); | ||
list(body, ordered) { | ||
const tag = ordered ? "ol" : "ul"; | ||
return `<${tag} class="duet-list">${body}</${tag}>`; | ||
}, | ||
paragraph: function (text) { | ||
return "<duet-paragraph>".concat(text, "</duet-paragraph>"); | ||
paragraph(text) { | ||
return `<duet-paragraph>${text}</duet-paragraph>`; | ||
}, | ||
table: function (header, body) { | ||
return "<duet-table><table><thead>".concat(header, "</thead><tbody>").concat(body, "</tbody></table></duet-table>"); | ||
table(header, body) { | ||
return `<duet-table><table><thead>${header}</thead><tbody>${body}</tbody></table></duet-table>`; | ||
}, | ||
link: function (href, _title, text) { | ||
return "<duet-link url=\"".concat(href, "\"").concat(isExternalUrl(href) ? " external" : "", ">").concat(text, "</duet-link>"); | ||
link(href, _title, text) { | ||
return `<duet-link url="${href}"${isExternalUrl(href) ? " external" : ""}>${text}</duet-link>`; | ||
}, | ||
}; | ||
} | ||
exports.createDuetMarkedRenderer = createDuetMarkedRenderer; |
{ | ||
"name": "@duetds/marked", | ||
"version": "3.0.51", | ||
"version": "3.1.0", | ||
"description": "This package includes Duet Markdown utilities and related tools.", | ||
@@ -68,8 +68,8 @@ "license": "SEE LICENSE IN LICENSE.md", | ||
"devDependencies": { | ||
"@babel/core": "7.21.0", | ||
"@babel/preset-env": "7.20.2", | ||
"@babel/core": "7.26.0", | ||
"@babel/preset-env": "7.26.0", | ||
"@types/marked": "4.0.8", | ||
"@typescript-eslint/parser": "5.54.0", | ||
"babel-jest": "29.4.3", | ||
"eslint": "8.35.0", | ||
"@typescript-eslint/parser": "8.14.0", | ||
"babel-jest": "29.7.0", | ||
"eslint": "9.14.0", | ||
"jest": "29.4.3", | ||
@@ -79,3 +79,3 @@ "jest-serializer-html": "7.1.0", | ||
"prettier": "2.8.4", | ||
"typescript": "4.9.5" | ||
"typescript": "5.4.5" | ||
}, | ||
@@ -88,3 +88,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "cb52b4d9fcf70d2289749fa3087b39ac1bb75df3" | ||
"gitHead": "072b360749f220207fc2aaf9d1ec10e5b643b782" | ||
} |
7169
36