@nuxtjs/mdc
Version:
Nuxt MDC module
20 lines (19 loc) • 594 B
JavaScript
import { kebabCase } from "scule";
import htmlTags from "../utils/html-tags-list.js";
import { getTagName } from "./utils.js";
export default function paragraph(state, node) {
if (node.children && node.children[0] && node.children[0].type === "html") {
const tagName = kebabCase(getTagName(node.children[0].value) || "div");
if (!htmlTags.includes(tagName)) {
return state.all(node);
}
}
const result = {
type: "element",
tagName: "p",
properties: {},
children: state.all(node)
};
state.patch(node, result);
return state.applyData(node, result);
}