turndown 7.1.0 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -162,6 +162,8 @@ The filter property determines whether or not an element should be replaced with
162
162
  * `filter: 'p'` will select `<p>` elements
163
163
  * `filter: ['em', 'i']` will select `<em>` or `<i>` elements
164
164
 
165
+ The tag names in the `filter` property are expected in lowercase, regardless of their form in the document.
166
+
165
167
  Alternatively, the filter can be a function that returns a boolean depending on whether a given node should be replaced. The function is passed a DOM node as well as the `TurndownService` options. For example, the following rule selects `<a>` elements (with an `href`) when the `linkStyle` option is `inlined`:
166
168
 
167
169
  ```js
package/dist/turndown.js CHANGED
@@ -1,8 +1,6 @@
1
- var TurndownService = (function (domino) {
1
+ var TurndownService = (function () {
2
2
  'use strict';
3
3
 
4
- domino = domino && Object.prototype.hasOwnProperty.call(domino, 'default') ? domino['default'] : domino;
5
-
6
4
  function extend (destination) {
7
5
  for (var i = 1; i < arguments.length; i++) {
8
6
  var source = arguments[i];
@@ -691,7 +689,7 @@ var TurndownService = (function (domino) {
691
689
  }
692
690
 
693
691
  function edgeWhitespace (string) {
694
- var m = string.match(/^(([ \t\r\n]*)(\s*))[\s\S]*?((\s*?)([ \t\r\n]*))$/);
692
+ var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
695
693
  return {
696
694
  leading: m[1], // whole string for whitespace-only strings
697
695
  leadingAscii: m[2],
@@ -972,4 +970,4 @@ var TurndownService = (function (domino) {
972
970
 
973
971
  return TurndownService;
974
972
 
975
- }(domino));
973
+ }());
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- require('domino');
4
-
5
3
  function extend (destination) {
6
4
  for (var i = 1; i < arguments.length; i++) {
7
5
  var source = arguments[i];
@@ -690,7 +688,7 @@ function flankingWhitespace (node, options) {
690
688
  }
691
689
 
692
690
  function edgeWhitespace (string) {
693
- var m = string.match(/^(([ \t\r\n]*)(\s*))[\s\S]*?((\s*?)([ \t\r\n]*))$/);
691
+ var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
694
692
  return {
695
693
  leading: m[1], // whole string for whitespace-only strings
696
694
  leadingAscii: m[2],
@@ -1,5 +1,3 @@
1
- import 'domino';
2
-
3
1
  function extend (destination) {
4
2
  for (var i = 1; i < arguments.length; i++) {
5
3
  var source = arguments[i];
@@ -688,7 +686,7 @@ function flankingWhitespace (node, options) {
688
686
  }
689
687
 
690
688
  function edgeWhitespace (string) {
691
- var m = string.match(/^(([ \t\r\n]*)(\s*))[\s\S]*?((\s*?)([ \t\r\n]*))$/);
689
+ var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
692
690
  return {
693
691
  leading: m[1], // whole string for whitespace-only strings
694
692
  leadingAscii: m[2],
@@ -1,10 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('domino')) :
3
- typeof define === 'function' && define.amd ? define(['domino'], factory) :
4
- (global = global || self, global.TurndownService = factory(global.domino));
5
- }(this, (function (domino) { 'use strict';
6
-
7
- domino = domino && Object.prototype.hasOwnProperty.call(domino, 'default') ? domino['default'] : domino;
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.TurndownService = factory());
5
+ }(this, (function () { 'use strict';
8
6
 
9
7
  function extend (destination) {
10
8
  for (var i = 1; i < arguments.length; i++) {
@@ -694,7 +692,7 @@
694
692
  }
695
693
 
696
694
  function edgeWhitespace (string) {
697
- var m = string.match(/^(([ \t\r\n]*)(\s*))[\s\S]*?((\s*?)([ \t\r\n]*))$/);
695
+ var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
698
696
  return {
699
697
  leading: m[1], // whole string for whitespace-only strings
700
698
  leadingAscii: m[2],
@@ -1,9 +1,5 @@
1
1
  'use strict';
2
2
 
3
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
-
5
- var domino = _interopDefault(require('domino'));
6
-
7
3
  function extend (destination) {
8
4
  for (var i = 1; i < arguments.length; i++) {
9
5
  var source = arguments[i];
@@ -585,9 +581,9 @@ function createHTMLParser () {
585
581
  var Parser = function () {};
586
582
 
587
583
  {
588
- var domino$1 = domino;
584
+ var domino = require('domino');
589
585
  Parser.prototype.parseFromString = function (string) {
590
- return domino$1.createDocument(string)
586
+ return domino.createDocument(string)
591
587
  };
592
588
  }
593
589
  return Parser
@@ -668,7 +664,7 @@ function flankingWhitespace (node, options) {
668
664
  }
669
665
 
670
666
  function edgeWhitespace (string) {
671
- var m = string.match(/^(([ \t\r\n]*)(\s*))[\s\S]*?((\s*?)([ \t\r\n]*))$/);
667
+ var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
672
668
  return {
673
669
  leading: m[1], // whole string for whitespace-only strings
674
670
  leadingAscii: m[2],
@@ -1,5 +1,3 @@
1
- import domino from 'domino';
2
-
3
1
  function extend (destination) {
4
2
  for (var i = 1; i < arguments.length; i++) {
5
3
  var source = arguments[i];
@@ -581,9 +579,9 @@ function createHTMLParser () {
581
579
  var Parser = function () {};
582
580
 
583
581
  {
584
- var domino$1 = domino;
582
+ var domino = require('domino');
585
583
  Parser.prototype.parseFromString = function (string) {
586
- return domino$1.createDocument(string)
584
+ return domino.createDocument(string)
587
585
  };
588
586
  }
589
587
  return Parser
@@ -664,7 +662,7 @@ function flankingWhitespace (node, options) {
664
662
  }
665
663
 
666
664
  function edgeWhitespace (string) {
667
- var m = string.match(/^(([ \t\r\n]*)(\s*))[\s\S]*?((\s*?)([ \t\r\n]*))$/);
665
+ var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
668
666
  return {
669
667
  leading: m[1], // whole string for whitespace-only strings
670
668
  leadingAscii: m[2],
@@ -1,10 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('domino')) :
3
- typeof define === 'function' && define.amd ? define(['domino'], factory) :
4
- (global = global || self, global.TurndownService = factory(global.domino));
5
- }(this, (function (domino) { 'use strict';
6
-
7
- domino = domino && Object.prototype.hasOwnProperty.call(domino, 'default') ? domino['default'] : domino;
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.TurndownService = factory());
5
+ }(this, (function () { 'use strict';
8
6
 
9
7
  function extend (destination) {
10
8
  for (var i = 1; i < arguments.length; i++) {
@@ -587,9 +585,9 @@
587
585
  var Parser = function () {};
588
586
 
589
587
  {
590
- var domino$1 = domino;
588
+ var domino = require('domino');
591
589
  Parser.prototype.parseFromString = function (string) {
592
- return domino$1.createDocument(string)
590
+ return domino.createDocument(string)
593
591
  };
594
592
  }
595
593
  return Parser
@@ -670,7 +668,7 @@
670
668
  }
671
669
 
672
670
  function edgeWhitespace (string) {
673
- var m = string.match(/^(([ \t\r\n]*)(\s*))[\s\S]*?((\s*?)([ \t\r\n]*))$/);
671
+ var m = string.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
674
672
  return {
675
673
  leading: m[1], // whole string for whitespace-only strings
676
674
  leadingAscii: m[2],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "turndown",
3
3
  "description": "A library that converts HTML to Markdown",
4
- "version": "7.1.0",
4
+ "version": "7.1.2",
5
5
  "author": "Dom Christie",
6
6
  "main": "lib/turndown.cjs.js",
7
7
  "module": "lib/turndown.es.js",
@@ -16,11 +16,12 @@
16
16
  "domino": "^2.1.6"
17
17
  },
18
18
  "devDependencies": {
19
- "@rollup/plugin-commonjs": "^11.0.2",
20
- "@rollup/plugin-node-resolve": "^7.1.1",
21
- "@rollup/plugin-replace": "^2.3.1",
22
- "browserify": "^16.2.3",
23
- "rollup": "^1.32.0",
19
+ "@rollup/plugin-commonjs": "^19.0.0",
20
+ "@rollup/plugin-node-resolve": "13.0.0",
21
+ "@rollup/plugin-replace": "2.4.2",
22
+ "browserify": "17.0.0",
23
+ "rewire": "^6.0.0",
24
+ "rollup": "2.52.3",
24
25
  "standard": "^10.0.3",
25
26
  "turndown-attendant": "0.0.3"
26
27
  },
@@ -36,7 +37,7 @@
36
37
  "license": "MIT",
37
38
  "repository": {
38
39
  "type": "git",
39
- "url": "https://github.com/domchristie/turndown.git"
40
+ "url": "https://github.com/mixmark-io/turndown.git"
40
41
  },
41
42
  "scripts": {
42
43
  "build": "npm run build-cjs && npm run build-es && npm run build-umd && npm run build-iife",
@@ -46,6 +47,6 @@
46
47
  "build-iife": "rollup -c config/rollup.config.iife.js",
47
48
  "build-test": "browserify test/turndown-test.js --outfile test/turndown-test.browser.js",
48
49
  "prepare": "npm run build",
49
- "test": "npm run build && npm run build-test && standard ./src/**/*.js && node test/turndown-test.js"
50
+ "test": "npm run build && npm run build-test && standard ./src/**/*.js && node test/internals-test.js && node test/turndown-test.js"
50
51
  }
51
52
  }