Giter Site home page Giter Site logo

retextjs / retext-syntax-urls Goto Github PK

View Code? Open in Web Editor NEW
9.0 5.0 0.0 108 KB

plugin to classify url-like values as syntax, not natural language

Home Page: https://unifiedjs.com

License: MIT License

JavaScript 100.00%
retext retext-plugin natural-language syntax url path file filepath filename

retext-syntax-urls's People

Contributors

wooorm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

retext-syntax-urls's Issues

Regression in 3.1.0 - TypeError: Cannot read property 'type' of undefined

Initial checklist

Affected packages and versions

3.1.0

Link to runnable example

n/a

Steps to reproduce

git clone [email protected]:IsaacScript/isaacscript.github.io.git
cd isaacscript.github.io.git
git checkout c7acddaaf2aa66dcc593040384f2a269894c0b8f
vim .remarkrc.mjs

Comment out the line that says .use(retextSyntaxURLs) and save the file.

./lint.sh

Notice that it succeeds.
Now, uncomment out the retextSyntaxURLs line.

./lint.sh

Notice that it fails with the following error:

docs\converting-lua-code.md
  1:1  error  TypeError: Cannot read property 'type' of undefined
    at mergeLinks (file:///D:/Repositories/isaacscript.github.io/node_modules/retext-syntax-urls/index.js:86:12)
    at Object.iteratee (file:///D:/Repositories/isaacscript.github.io/node_modules/retext-syntax-urls/node_modules/unist-util-modify-children/index.js:48:12)
    at arrayIterate (file:///D:/Repositories/isaacscript.github.io/node_modules/retext-syntax-urls/node_modules/array-iterate/index.js:37:25)
    at Array.iterator (file:///D:/Repositories/isaacscript.github.io/node_modules/retext-syntax-urls/node_modules/unist-util-modify-children/index.js:37:5)
    at Of.run (file:///D:/Repositories/isaacscript.github.io/node_modules/parse-latin/lib/index.js:46:23)
    at Of.Constructor.<computed> [as tokenizeSentence] (file:///D:/Repositories/isaacscript.github.io/node_modules/parse-latin/lib/index.js:374:17)
    at Of.parser (file:///D:/Repositories/isaacscript.github.io/node_modules/parse-latin/lib/parser.js:13:43)
    at Of.Constructor.<computed> [as tokenizeParagraph] (file:///D:/Repositories/isaacscript.github.io/node_modules/parse-latin/lib/index.js:374:35)
    at Of.parser (file:///D:/Repositories/isaacscript.github.io/node_modules/parse-latin/lib/parser.js:13:43)
    at Of.Constructor.<computed> [as tokenizeRoot] (file:///D:/Repositories/isaacscript.github.io/node_modules/parse-latin/lib/index.js:374:35)

Separately, you can confirm that this is a regression in this specific package by setting "retext-syntax-mentions": "3.0.0", in the package.json file, doing an npm install, and then running ./lint.sh, and observe that it succeeds (without commenting anything out).

Expected behavior

It should not produce any errors.

Actual behavior

It does produce an error.

Runtime

Node v16

Package manager

npm v7

OS

Windows

Build and bundle tools

Docusaurus

Issue with parsing on-premise URLs

Initial checklist

Affected packages and versions

3.1.1

Link to runnable example

No response

Steps to reproduce

The plugin fails to parse on-premise URL. Example:

import { unified } from "unified";
import retextEnglish from "retext-english";
import retextSyntaxUrls from "retext-syntax-urls";
import { visit } from 'unist-util-visit';
import { inspect } from 'unist-util-inspect';

const content = 'on-premise URL: https://CorporateIntranet/page.aspx'
const processor = unified()
            .use(retextEnglish)
            .use(retextSyntaxUrls);
const tree = processor.parse(content);
console.log(inspect(tree));

Expected behavior

The source node should be: https://CorporateIntranet/page.aspx

Actual behavior

The source node is: page.aspx

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

Issue with parenthesis

Initial checklist

Affected packages and versions

3.1.1

Link to runnable example

No response

Steps to reproduce

import { unified } from "unified";
import retextEnglish from "retext-english";
import retextSyntaxUrls from "retext-syntax-urls";
import { visit } from 'unist-util-visit';
import { inspect } from 'unist-util-inspect';

const content = 'Incorrect source node (e.g. [email protected])'
const processor = unified()
            .use(retextEnglish)
            .use(retextSyntaxUrls);
const tree = processor.parse(content);
console.log(inspect(tree));

The bug is described below.

In addition, if I change the content to:

const content = '(e.g. [email protected])'

The library will give an exception saying that: 'TypeError: Cannot read properties of undefined (reading 'type')'

Expected behavior

Source node is '[email protected]'.

Actual behavior

Source nodes are: '(e.g' and '[email protected])'

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.