0.24.0 • Published 4 years ago
@xmark/transform-class-extension v0.24.0
@xmark/transform-class-extension
xmark plugin to transform nodes with certain class in hast
Usage
yarn add @xmark/core @xmark/transform-class-extension
const inspect = require('unist-util-inspect');
const XMark = require('@xmark/core');
const plugin = require('@xmark/transform-class-extension');
const xmark = XMark();
xmark.useTransform(plugin, {
extensions: {
'.action-button': { propertyPath: 'tagName', value: 'action-button' },
'.mui-paper': { propertyPath: 'tagName', value: 'mui-paper' },
'.mui-grid-item': { propertyPath: 'tagName', value: 'mui-grid-item' },
'.mui-grid-container': { propertyPath: 'tagName', value: 'mui-grid-container' },
'.contact-form': { propertyPath: 'tagName', value: 'contact-form' },
},
});
const markdown = `[Link](https://www.arcblock.io){.action-button}`;
const hast = xmark.toHAST(markdown);
console.log(inspect(hast));
will output:
root[1] [data={"quirksMode":false}]
└─ element[1] (1:1-1:48, 0-47) [tagName="p"]
└─ element[1] (1:1-1:48, 0-47) [tagName="action-button"][properties={"href":"https://www.arcblock.io","className":["action-button"]}]
└─ text: "Link" (1:2-1:6, 1-5)
0.24.0
4 years ago
0.23.1
4 years ago
0.22.0
4 years ago
0.21.0
4 years ago
0.20.0
5 years ago
0.19.0
5 years ago
0.18.0
5 years ago
0.17.0
5 years ago
0.16.0
5 years ago
0.15.0
5 years ago
0.14.0
5 years ago
0.13.0
5 years ago
0.12.0
5 years ago
0.11.0
5 years ago
0.10.0
5 years ago
0.9.2
5 years ago
0.9.1
5 years ago
0.8.0
5 years ago
0.7.0
5 years ago
0.6.0
5 years ago
0.5.0
5 years ago
0.4.1
5 years ago
0.3.0
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago