@yozora/tokenizer-autolink-extension 2.0.0-alpha.1 → 2.0.0-alpha.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/lib/cjs/index.js CHANGED
@@ -257,7 +257,7 @@ const match = function (api) {
257
257
 
258
258
  const parse = function (api) {
259
259
  return {
260
- parse: (token, children) => {
260
+ parse: tokens => tokens.map(token => {
261
261
  const nodePoints = api.getNodePoints();
262
262
  let url = character.calcStringFromNodePoints(nodePoints, token.startIndex, token.endIndex);
263
263
  switch (token.contentType) {
@@ -268,13 +268,12 @@ const parse = function (api) {
268
268
  url = 'http://' + url;
269
269
  break;
270
270
  }
271
- const result = {
272
- type: ast.LinkType,
273
- url,
274
- children,
275
- };
276
- return result;
277
- },
271
+ const children = api.parseInlineTokens(token.children);
272
+ const node = api.shouldReservePosition
273
+ ? { type: ast.LinkType, position: api.calcPosition(token), url, children }
274
+ : { type: ast.LinkType, url, children };
275
+ return node;
276
+ }),
278
277
  };
279
278
  };
280
279
 
package/lib/esm/index.js CHANGED
@@ -253,7 +253,7 @@ const match = function (api) {
253
253
 
254
254
  const parse = function (api) {
255
255
  return {
256
- parse: (token, children) => {
256
+ parse: tokens => tokens.map(token => {
257
257
  const nodePoints = api.getNodePoints();
258
258
  let url = calcStringFromNodePoints(nodePoints, token.startIndex, token.endIndex);
259
259
  switch (token.contentType) {
@@ -264,13 +264,12 @@ const parse = function (api) {
264
264
  url = 'http://' + url;
265
265
  break;
266
266
  }
267
- const result = {
268
- type: LinkType,
269
- url,
270
- children,
271
- };
272
- return result;
273
- },
267
+ const children = api.parseInlineTokens(token.children);
268
+ const node = api.shouldReservePosition
269
+ ? { type: LinkType, position: api.calcPosition(token), url, children }
270
+ : { type: LinkType, url, children };
271
+ return node;
272
+ }),
274
273
  };
275
274
  };
276
275
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yozora/tokenizer-autolink-extension",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.2",
4
4
  "author": {
5
5
  "name": "guanghechen",
6
6
  "url": "https://github.com/guanghechen/"
@@ -35,10 +35,10 @@
35
35
  "test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
36
36
  },
37
37
  "dependencies": {
38
- "@yozora/ast": "^2.0.0-alpha.1",
39
- "@yozora/character": "^2.0.0-alpha.1",
40
- "@yozora/core-tokenizer": "^2.0.0-alpha.1",
41
- "@yozora/tokenizer-autolink": "^2.0.0-alpha.1"
38
+ "@yozora/ast": "^2.0.0-alpha.2",
39
+ "@yozora/character": "^2.0.0-alpha.2",
40
+ "@yozora/core-tokenizer": "^2.0.0-alpha.2",
41
+ "@yozora/tokenizer-autolink": "^2.0.0-alpha.2"
42
42
  },
43
- "gitHead": "86202e1d2b03ccfc2ab030517d9d314f7aee7666"
43
+ "gitHead": "da59d85520455c59a117a35032ef1a035c10ea21"
44
44
  }