1
0
Fork 0
This repository has been archived on 2024-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
markdown-it-attr/test/index.js
2021-05-25 10:43:17 +09:00

35 lines
1 KiB
JavaScript

const mdi = require('markdown-it');
const mrt = require('@sup39/markdown-it-raw-table');
const mia = require('..');
const test = require('./test');
describe('Attributes', () => {
const md = mdi().use(mia);
test(md, 'attrs.txt');
});
describe('Common', () => {
const md = mdi().use(mia);
test(md, 'common.txt');
});
describe('Escape', () => {
const md = mdi().use(mia);
test(md, 'escape.txt');
});
describe('Table (with @sup39/markdown-it-raw-table)', () => {
const md = mdi().use(mrt).use(mia);
// enable raw_table_tr
mia.inlineAttrsApplyRules.find(e=>e.name==='raw_table_tr').disabled = false;
test(md, 'table.txt');
});
describe('No-Filtering', () => {
const mdd = mdi().use(mia);
test(mdd, 'filtering-default.txt');
});
describe('Filtering', () => {
const md = mdi().use(mia, {
/* eslint-disable-next-line max-len */
re: /\#(?<id>[^\s#.="'}]+)|\.(?<class>[^\s#.="'}]+)|(?:on[^\s#.="'}]+|(?<attr>[^\s#.="'}]+))(?:\=(?<val>[^\s}"'][^\s}]*|(?<q>["']).*?\k<q>))?|(?<term>})/g,
});
test(md, 'filtering.txt');
});