ep_markdown 0.1.78 → 1.0.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.
@@ -1,12 +1,16 @@
1
1
  'use strict';
2
2
 
3
- const Changeset = require('ep_etherpad-lite/static/js/Changeset');
3
+
4
+ import {splitAttributionLines, opIterator,subattribution,eachAttribNumber, opAttributeValue} from 'ep_etherpad-lite/static/js/Changeset'
5
+ import {StringIterator} from 'ep_etherpad-lite/static/js/StringIterator'
6
+ import {StringAssembler} from 'ep_etherpad-lite/static/js/StringAssembler'
7
+
4
8
  const padManager = require('ep_etherpad-lite/node/db/PadManager');
5
9
 
6
10
  const getMarkdownFromAtext = (pad, atext) => {
7
11
  const apool = pad.apool();
8
12
  const textLines = atext.text.slice(0, -1).split('\n');
9
- const attribLines = Changeset.splitAttributionLines(atext.attribs, atext.text);
13
+ const attribLines = splitAttributionLines(atext.attribs, atext.text);
10
14
  const tags = ['**', '*', '[]', '~~'];
11
15
  const props = ['bold', 'italic', 'underline', 'strikethrough'];
12
16
  const anumMap = {};
@@ -57,8 +61,8 @@ const getMarkdownFromAtext = (pad, atext) => {
57
61
  // <b>Just bold<b> <b><i>Bold and italics</i></b> <i>Just italics</i>
58
62
  // becomes
59
63
  // <b>Just bold <i>Bold and italics</i></b> <i>Just italics</i>
60
- const taker = Changeset.stringIterator(text);
61
- let assem = Changeset.stringAssembler();
64
+ const taker = new StringIterator(text);
65
+ let assem = new StringAssembler();
62
66
 
63
67
  const openTags = [];
64
68
  const emitOpenTag = (i) => {
@@ -86,12 +90,12 @@ const getMarkdownFromAtext = (pad, atext) => {
86
90
  // start heading check
87
91
  let heading = false;
88
92
  let deletedAsterisk = false; // we need to delete * from the beginning of the heading line
89
- const iter2 = Changeset.opIterator(Changeset.subattribution(attribs, 0, 1));
93
+ const iter2 = opIterator(subattribution(attribs, 0, 1));
90
94
  if (iter2.hasNext()) {
91
95
  const o2 = iter2.next();
92
96
 
93
97
  // iterate through attributes
94
- Changeset.eachAttribNumber(o2.attribs, (a) => {
98
+ eachAttribNumber(o2.attribs, (a) => {
95
99
  if (a in headinganumMap) {
96
100
  const i = headinganumMap[a]; // i = 0 => bold, etc.
97
101
  heading = headingtags[i];
@@ -112,13 +116,13 @@ const getMarkdownFromAtext = (pad, atext) => {
112
116
  return;
113
117
  }
114
118
 
115
- const iter = Changeset.opIterator(Changeset.subattribution(attribs, idx, idx + numChars));
119
+ const iter = opIterator(subattribution(attribs, idx, idx + numChars));
116
120
  idx += numChars;
117
121
 
118
122
  while (iter.hasNext()) {
119
123
  const o = iter.next();
120
124
  let propChanged = false;
121
- Changeset.eachAttribNumber(o.attribs, (a) => {
125
+ eachAttribNumber(o.attribs, (a) => {
122
126
  if (a in anumMap) {
123
127
  const i = anumMap[a]; // i = 0 => bold, etc.
124
128
  if (!propVals[i]) {
@@ -286,9 +290,9 @@ const _analyzeLine = (text, aline, apool) => {
286
290
  let lineMarker = 0;
287
291
  line.listLevel = 0;
288
292
  if (aline) {
289
- const opIter = Changeset.opIterator(aline);
293
+ const opIter = opIterator(aline);
290
294
  if (opIter.hasNext()) {
291
- let listType = Changeset.opAttributeValue(opIter.next(), 'list', apool);
295
+ let listType = opAttributeValue(opIter.next(), 'list', apool);
292
296
  if (listType) {
293
297
  lineMarker = 1;
294
298
  listType = /([a-z]+)([12345678])/.exec(listType);
@@ -301,7 +305,7 @@ const _analyzeLine = (text, aline, apool) => {
301
305
  }
302
306
  if (lineMarker) {
303
307
  line.text = text.substring(1);
304
- line.aline = Changeset.subattribution(aline, 1);
308
+ line.aline = subattribution(aline, 1);
305
309
  } else {
306
310
  line.text = text;
307
311
  line.aline = aline;
@@ -2,8 +2,8 @@
2
2
 
3
3
  const eejs = require('ep_etherpad-lite/node/eejs');
4
4
  const settings = require('ep_etherpad-lite/node/utils/Settings');
5
- const fs = require('fs');
6
- const fsp = fs.promises;
5
+ import {promises} from 'fs';
6
+ const fsp = promises
7
7
 
8
8
  exports.eejsBlock_exportColumn = (hookName, context) => {
9
9
  context.content += eejs.require('./templates/exportcolumn.html', {}, module);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ep_markdown",
3
3
  "description": "Edit and Export as Markdown in Etherpad",
4
- "version": "0.1.78",
4
+ "version": "1.0.2",
5
5
  "author": {
6
6
  "name": "John McLear",
7
7
  "email": "john@mclear.co.uk",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/ether/ep_markdown.git"
12
+ "url": "https://github.com/ether/ether-plugins.git"
13
13
  },
14
14
  "dependencies": {
15
15
  "showdown": "*"
@@ -21,20 +21,24 @@
21
21
  "url": "https://etherpad.org/"
22
22
  },
23
23
  "devDependencies": {
24
- "eslint": "^8.57.0",
24
+ "eslint": "^9.24.0",
25
25
  "eslint-config-etherpad": "^4.0.4",
26
- "typescript": "^5.4.2",
26
+ "typescript": "^5.4.3",
27
27
  "@types/mocha": "^10.0.6",
28
28
  "@types/node": "^20.12.4"
29
29
  },
30
30
  "engines": {
31
- "node": ">=18.0.0"
31
+ "node": ">=20.0.0"
32
32
  },
33
33
  "peerDependenciesMeta": {
34
34
  "ep_headings2": {
35
35
  "optional": true
36
36
  }
37
37
  },
38
+ "bugs": {
39
+ "url": "https://github.com/ether/ether-plugins/issues"
40
+ },
41
+ "homepage": "https://github.com/ether/ether-plugins/tree/main/ep_markdown#readme",
38
42
  "scripts": {
39
43
  "lint": "eslint .",
40
44
  "lint:fix": "eslint --fix ."
File without changes