remark-break-line 0.0.11 → 0.0.12

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.
Files changed (2) hide show
  1. package/lib/index.js +13 -9
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -38,15 +38,15 @@ const elementSize = {
38
38
  * @returns
39
39
  * Transform.
40
40
  */
41
- export default function remarkBreakLongLines({ maxLineLength = Number.POSITIVE_INFINITY, removeLinebreaksAndMultipleSpaces = true, mergableElements = ['emphasis'] } = {}) {
41
+ export default function remarkBreakLongLines({ maxLineLength = 80, removeLinebreaksAndMultipleSpaces = false, mergableElements = [] } = {}) {
42
42
  /**
43
- * Transform.
44
- *
45
- * @param {Root} tree
46
- * Tree.
47
- * @returns {undefined}
48
- * Nothing.
49
- */
43
+ * Transform.
44
+ *
45
+ * @param {Root} tree
46
+ * Tree.
47
+ * @returns {undefined}
48
+ * Nothing.
49
+ */
50
50
  return function (tree) {
51
51
  visit(tree, function (node) {
52
52
  if (node.type === 'paragraph') {
@@ -229,7 +229,11 @@ export default function remarkBreakLongLines({ maxLineLength = Number.POSITIVE_I
229
229
  // we need to split the node
230
230
  const current = path[path.length - 1];
231
231
  assert(current === 'text');
232
-
232
+ if (lastIndex === -1) {
233
+ return {
234
+ type: 'break-before'
235
+ }
236
+ }
233
237
  return {
234
238
  type: 'split',
235
239
  replaceBy: [{ type: 'text', value: n.value.substring(0, lastIndex) }, { type: 'text', value: n.value.substring(lastIndex + 1) }]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remark-break-line",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "keywords": [