Closed noniq closed 8 years ago
Nice! Will need to test this out but seems like a big win.
:metal:
Let me know if you experience any problems. I’m already using this branch, for me everything seems to work fine.
I get "Preview: line 13: /Users/mike/Library/Application: No such file or directory" when testing this.
Looks like a variable that needs quoted?
Ah, of course … I think the preview command in the current version of TextMate's Markdown bundle has a quoting issue. https://github.com/textmate/markdown.tmbundle/pull/39 contains a fix but has not meen merged yet.
Not sure if my fix was entirely correct, though. @infininight, do we need to quote env vars when setting them from the bundle? If so, how?
@noniq Cool, can you give me a shout when that's merged and I'll retest? Thanks!
Not quoting the variable was a deliberate change: textmate/markdown.tmbundle@13d3d314fcc51b8229782fcc555e6efa2c34ed78.
Either we quote the use of TM_MARKDOWN
and thus drop support for providing extra arguments, or alternatively this commit needs to be changed to set TM_MARKDOWN
to something like: eval '$TM_BUNDLE_SUPPORT/bin/redcarpet.rb'
. This assumes that there is no single quote in the value of TM_BUNDLE_SUPPORT
, a fairly safe assumption, but to be 100% safe it should probably be: eval '${TM_BUNDLE_SUPPORT/'/'\''/g}/bin/redcarpet.rb'
.
What do you guys think?
Allowing for arguments make sense. I’ll update the PR to include quoting!
Updated! This PR should now work correctly even with the current state of the bundle support bundle.
(I also made a corresponding change to https://github.com/textmate/bundle-support.tmbundle/pull/19 where I reverted the additional quoting I had introduced before.)
Great, thanks @noniq!
@noniq Relatedly, because of your great work here when @sorbits
added the support to repreview automatically on file changes this Just Works in the GitHub Markdown preview too without this needing any changes 🎉
As discussed by @sorbits in http://lists.macromates.com/textmate/2016-July/039722.html this achieves the same result with less code. And it will also allow to use
TM_MARKDOWN_FILTER
for things like stripping front matter in the future.