zhuochun / md-writer

✒️ Make Atom a better Markdown/AsciiDoc editor for writers and bloggers
https://atom.io/packages/markdown-writer
MIT License
341 stars 46 forks source link

Failed to Create Draft #129

Closed miklb closed 8 years ago

miklb commented 8 years ago

Attempting to create a new draft with the plugin.

[Enter steps to reproduce below:]

1.Markdown-Writer->New Draft

Atom Version: 1.6.2 System: Mac OS X 10.11.4 Thrown From: markdown-writer package, v2.3.2

Stack Trace

Failed to activate the markdown-writer package

At Syntax error on line 13, column 13: Unexpected token j

SyntaxError: Syntax error on line 13, column 13: Unexpected token j
  at nodeTransforms.Literal (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:100:15)
  at transformNode (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:197:12)
  at nodeTransforms.Value (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:79:14)
  at transformNode (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:197:12)
  at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:114:17
  at Array.reduce (native)
  at nodeTransforms.Obj (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:107:30)
  at transformNode (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:197:12)
  at nodeTransforms.Value (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:79:14)
  at transformNode (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:197:12)
  at nodeTransforms.Block (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:76:14)
  at transformNode (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:197:12)
  at Object.parse (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/node_modules/cson-parser/lib/parse.js:203:12)
  at parseObject (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/lib/cson.js:42:23)
  at parseContentsSync (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/lib/cson.js:68:16)
  at Object.module.exports.readFileSync (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/season/lib/cson.js:170:14)
  at Object.module.exports._loadProjectConfig (/Users/miklb/.atom/packages/markdown-writer/lib/config.coffee:116:42)
  at Object.module.exports.getProject (/Users/miklb/.atom/packages/markdown-writer/lib/config.coffee:100:15)
  at Object.module.exports.getEngine (/Users/miklb/.atom/packages/markdown-writer/lib/config.coffee:81:15)
  at Object.module.exports.getCurrentDefault (/Users/miklb/.atom/packages/markdown-writer/lib/config.coffee:89:6)
  at Object.<anonymous> (/Users/miklb/.atom/packages/markdown-writer/lib/config-basic.coffee:48:21)
  at Object.<anonymous> (/Users/miklb/.atom/packages/markdown-writer/lib/config-basic.coffee:1:1)
  at Module._compile (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:103:30)
  at Object.defineProperty.value [as .coffee] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:208:21)
  at Module.load (module.js:355:32)
  at Function.Module._load (module.js:310:12)
  at Module.require (module.js:365:17)
  at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
  at Object.<anonymous> (/Users/miklb/.atom/packages/markdown-writer/lib/markdown-writer.coffee:4:15)
  at Object.<anonymous> (/Users/miklb/.atom/packages/markdown-writer/lib/markdown-writer.coffee:1:1)
  at Module._compile (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:103:30)
  at Object.defineProperty.value [as .coffee] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:208:21)
  at Module.load (module.js:355:32)
  at Function.Module._load (module.js:310:12)
  at Module.require (module.js:365:17)
  at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
  at Package.module.exports.Package.requireMainModule (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:720:27)
  at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:172:16)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:800:25
  at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
  at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:241:20)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
  at CommandPaletteView.module.exports.CommandPaletteView.confirmed (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/command-palette/lib/command-palette-view.js:183:32)
  at CommandPaletteView.module.exports.SelectListView.confirmSelection (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:338:21)
  at space-pen-div.atom.commands.add.core:confirm (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-space-pen-views/lib/select-list-view.js:109:19)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
  at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeydown (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:97:36)
  at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -0:23.8.0 command-palette:toggle (atom-pane.pane.active)
     -0:16.9.0 core:move-down (atom-text-editor.editor.mini.is-focused)
  4x -0:15.5.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -0:12 core:move-down (atom-text-editor.editor.mini.is-focused)
     -0:11.4.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -0:09.4.0 markdown-writer:new-draft (atom-pane.pane.active)

Config

{
  "core": {
    "disabledPackages": [
      "markdown-format",
      "atom-prettify",
      "linter-php",
      "Zen",
      "alignment",
      "foldingtext-markdown",
      "atom-liquid-snippets",
      "nodeschool",
      "wordpress",
      "codebug"
    ],
    "ignoredNames": [
      ".git",
      ".svn",
      ".DS_Store"
    ],
    "themes": [
      "atom-light-ui",
      "solarized-light-syntax"
    ]
  }
}

Installed Packages

# User
Atom-Syntax-highlighting-for-Sass, v0.5.0
aligner, v0.19.1
aligner-php, v1.0.0
atom-beautify, v0.29.0
csslint, v1.1.4
language-liquid, v0.4.0
linter, v1.11.4
linter-alex, v2.0.0
linter-phpcs, v1.3.1
linter-proselint, v3.0.0
linter-sass-lint, v1.3.0
markdown-writer, v2.3.2
php-cs-fixer, v2.5.6
project-manager, v2.9.3
selection-counter, v1.0.0
selector-to-tag, v0.4.1
tabs-to-spaces, v1.0.2
travis-ci-status, v1.0.0
wordpress-api, v1.2.2

# Dev
No dev packages

Let me know if you need anything else.

zhuochun commented 8 years ago

Looks like you have set up a project specific config file, and there is some error in it. Can share your project config file?

miklb commented 8 years ago

Sure. Maybe my custom Front Matter? _mdwriter.cson.txt

miklb commented 8 years ago

So seems everything needs to be in quotes i.e. siteEngine: "jekyll", which is what was throwing the error reported. Now I'm getting an error EACCES Permission denied mkdir /~

I already have a _drafts directory in my Jekyll project.

zhuochun commented 8 years ago

Great for solving the syntax error. For the 2nd, what do you see in the field Site Directory in the New Draft dialog?

Are you in your project's root directory? Because project config won't be used if atom open project is not at project's root directory. Then you have to setup the global config, in packages -> markdown-writer config.

miklb commented 8 years ago

In the dialog box it shows Site Directory: ~/path/to/jekyll (what is set in the mdwriter.cson file) and Create draft at_drafts/new-file.md`

Not sure I follow about open project at project root directory.

miklb commented 8 years ago

OK, I removed anything in Site Directory: and it now shows /Users/myuser/path/to/jekyll and can publish a draft.

Confusing, but can continue testing.

zhuochun commented 8 years ago

Can try to put /Users/myuser/... instead of ~/...? Might be ~ is not handled correctly.

miklb commented 8 years ago

That works.

zhuochun commented 8 years ago

Thanks. Will look into this.