arobase-che / remark-attr

Remark plugin to add support for custom attributes
Other
57 stars 16 forks source link

'Missing parser to attach `remark-attr` [link] (to) #34

Open bluellyr opened 1 year ago

bluellyr commented 1 year ago

Hi, I am trying to use remark and the module remark-attr for the first time in a project but I am getting the following error:

/node_modules/remark-attr/dist/index.js:352
    throw new Error('Missing parser to attach `remark-attr` [link] (to)');
          ^

Error: Missing parser to attach `remark-attr` [link] (to)
    at Function.remarkAttr (/project/node_modules/remark-attr/dist/index.js:352:11)
    at Function.freeze (file:///project/node_modules/unified/lib/index.js:136:36)
    at Function.process (file:///project/node_modules/unified/lib/index.js:375:15)
    at file:///project/index.js:21:6
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:541:24)
    at async loadESM (node:internal/process/esm_loader:91:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)

Node.js v18.7.0

The package.json is:

{
  "name": "remark-attr",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "rehype-stringify": "^9.0.3",
    "remark-attr": "^0.11.1",
    "remark-parse": "^10.0.1",
    "remark-rehype": "^10.1.0",
    "unified": "^10.1.2"
  },
  "type": "module"
}

The index.js is:

import {unified} from 'unified'
import remarkParse from 'remark-parse'
import stringify from 'rehype-stringify'
import remark2rehype from 'remark-rehype'
import remarkAttr from 'remark-attr'

const testFile = `

Here a test :

![ache avatar](https://ache.one/res/ache.svg){ height=100 }

`

unified()
    .use(remarkParse)
    .use(remarkAttr)
    .use(remark2rehype)
    .use(stringify)
    .process(testFile, (err, file) => {
        console.log(String(file))
    })

Can you help?

I really wanted to use the remark and rehype but if there is no solution I really need to find another alternative because the markdown will use a lot of attributes in markdown.

Please let know if there is a solution. Thank you for your time

arobase-che commented 1 year ago

Than you for you interest in remark-attr. Sorry, this plugin isn't compatible with the last version of remark, since the use of micromark.

I'm pretty sure it's the error you encounter.

The last versions compatible is :

The amount of work it takes to make it compatible is way too much for me at the moment.

There is some alternatives with the last version of markdown. Please have a lock to the list of plugins.

bluellyr commented 1 year ago

Hi, thank you for your feedback.

I would really like to use the remark-attrbut I understand the the time constrains and effort to put it working.

This is the only one I have found on the list: remark-heading-id maybe I could change it to work as I need or maybe just use markdown-it instead.

Nonetheless I will be checking for any progress on remark-attr.

Thank you All the best

bluellyr commented 1 year ago

Hi, the remark-heading-id is not working also despite being marked as green on the list.

Sorry about this take, I am a newbie on using remark and maybe after reading about the unified and waiting for some time to use it in a project my expectations where high. I really like the remark and all the unified project approach, effort and the underlying philosophy but I am encounter some loose ends that make it nearly impossible to use it.

I understand is not easy to maintain an open source project that is dependent on other project up to date, most of the time.

Thank you for your time and effort All the best