diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..449fcde --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm test diff --git a/CHANGELOG.md b/CHANGELOG.md index 734e5ec..5e57794 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ For detailed information check [Blogophon's releases on Github](https://github.c * 🎁 Add Spotify embedding * 🎁 JSON-LD added * 🎁 Changed code highlighting for Bash prompt +* 🎁 Add additional `class` to `td` with a tag inside 2.1.7 ----- diff --git a/lib/helpers/marky-mark.js b/lib/helpers/marky-mark.js index e039d94..28829e5 100644 --- a/lib/helpers/marky-mark.js +++ b/lib/helpers/marky-mark.js @@ -690,6 +690,7 @@ const markyMark = function(string, rules) { }) .replace(/(\s*<)td([^>]+?text-align:\s?left.+?<\/)td(>)/g, '$1th scope="row"$2th$3') //.replace(/([\s\S]+?)(<\/tbody>)/g, '$2$1') + .replace(/(]*)(>\s*<)([^>]+)(>[^<]+<\/\3>\s*<\/td>)/g, '$1 class="tag-$3"$2$3$4') .replace(/(<(th|td))(.+?)\s+([²³⁴⁡⁢⁷⁸⁹])(<\/\2>)/g, (all, before, tag, content, index, after) => { let colspan = index.charCodeAt(0); colspan -= (colspan > 8000) ? 8304 : 176; diff --git a/package.json b/package.json index 77b0e34..ffde5c9 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "gulp-sass": "^5.0.0", "gulp-stylelint": "^13.0.0", "gulp-uglify": "^3.0.2", - "husky": "^6.0.0", + "husky": "^7.0.0", "mocha": "^9.0.1", "stylelint": "^13.11.0", "stylelint-config-recommended-scss": "^4.2.0", diff --git a/test/marky-mark.js b/test/marky-mark.js index 81cadbe..3175572 100644 --- a/test/marky-mark.js +++ b/test/marky-mark.js @@ -253,14 +253,24 @@ describe('MarkyMark', function() { Das bist du und so ⁴ + + Das bist du und so + Das bist du und so + Test + Das bist du und so + `; let m = markyMark(x); assert.ok(m, 'Got output'); - assert.equal(m.match(/colspan="\d"/g).length, 1, 'Colspan added'); - assert.equal(m.match(/