notslang / tidy-markdown

Beautify Markdown, fixing formatting mistakes and standardizing syntax
https://npmjs.com/package/tidy-markdown
GNU General Public License v3.0
75 stars 11 forks source link

could not determine a constructor for the tag tag:yaml.org,2002:js/regexp #8

Open Glavin001 opened 9 years ago

Glavin001 commented 9 years ago

Input


---

title: This is a title!

name: Derek Worthen
age: young
contact:
email: email@domain.com
address: some location
pets:
- cat
- dog
- bat
match: !!js/regexp /pattern/gim
run: !!js/function function() { }

---

- item
-  item
-   item

1. one
2.  two
2.   three

Expected Output

This is from Pandoc.


---
title: "This is a title!"
name: Derek Worthen
age: young
contact: null
email: "email@domain.com"
address: some location
pets:
  - cat
  - dog
  - bat
match: !<tag:yaml.org,2002:js/regexp> /pattern/gmi
run: !<tag:yaml.org,2002:js/function> "function () {\n   \n}"

---

-   item
-   item
-   item

1.  one
2.  two
3.  three

Current Output

It errors.

could not determine a constructor for the tag tag:yaml.org,2002:js/regexp
on line 12, column 8
at ConstructorError.YAMLError (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/errors.js:70:46)
at ConstructorError.MarkedYAMLError (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/errors.js:90:45)
at new ConstructorError (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/constructor.js:17:53)
at Constructor.Constructor.construct_undefined (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/constructor.js:550:13)
at Constructor.BaseConstructor.BaseConstructor.construct_object (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/constructor.js:133:28)
at Constructor.BaseConstructor.BaseConstructor.construct_mapping (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/constructor.js:173:22)
at Constructor.Constructor.construct_mapping (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/constructor.js:294:54)
at /Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/constructor.js:521:23
at Constructor.BaseConstructor.BaseConstructor.construct_document (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/constructor.js:88:41)
at Constructor.BaseConstructor.BaseConstructor.get_single_data (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/constructor.js:79:21)
at Object.load (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/node_modules/yaml-js/lib/yaml.js:112:20)
at parse (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/index.js:28:27)
at extractor (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/node_modules/front-matter/index.js:21:34)
at module.exports (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/tidy-markdown/lib/index.js:304:15)
at module.exports.TidyMarkdown.beautify (/Users/glavin/Documents/Project Dev/atom-beautify/src/beautifiers/tidy-markdown.coffee:13:29)
at tryCatcher (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/bluebird/js/main/util.js:24:31)
at Promise.module.exports.Promise._resolveFromResolver (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/bluebird/js/main/promise.js:427:31)
at new Promise (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/bluebird/js/main/promise.js:53:37)
at TidyMarkdown.module.exports.TidyMarkdown.beautify (/Users/glavin/Documents/Project Dev/atom-beautify/src/beautifiers/tidy-markdown.coffee:11:20)
at module.exports.Beautifiers.beautify (/Users/glavin/Documents/Project Dev/atom-beautify/src/beautifiers/index.coffee:163:28)
at tryCatcher (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/bluebird/js/main/util.js:24:31)
at Promise.module.exports.Promise._resolveFromResolver (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/bluebird/js/main/promise.js:427:31)
at new Promise (/Users/glavin/Documents/Project Dev/atom-beautify/node_modules/bluebird/js/main/promise.js:53:37)
at Beautifiers.module.exports.Beautifiers.beautify (/Users/glavin/Documents/Project Dev/atom-beautify/src/beautifiers/index.coffee:100:20)
at beautify-languages-spec.coffee:155:40

/cc https://github.com/Glavin001/atom-beautify/issues/292

notslang commented 9 years ago

this seems to be an issue with yaml-js, which front-matter depends upon... I'll make an issue there, or just switch to js-yaml & fork front-matter

Glavin001 commented 9 years ago

I was using yaml-front-matter for Atom Beautify. It uses js-yaml.