emgoto / emgoto-comments

This hosts the comments for my blog, emgoto.com.
https://emgoto.com
0 stars 0 forks source link

ulysses-to-markdown/ #12

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

How to export from Ulysses to Markdown · Emma Goto

I use the Ulysses text editor to write all my posts. Converting them into Markdown files for my blog isn’t as easy as copy-pasting…

https://www.emgoto.com/ulysses-to-markdown/?utterances=3e1b8dfc5c1926fc2d957492lVXql4e9V%2F4I8JpGfH%2Buvtk7Fj6uJ9ouaJQDcSNWuynwQqSFZ9yyMQtlkpjknrJmQ6ARwDKqQrhJu%2FjPE7BKEZjNVghb2RQJW6F4LLKtEwLeLJ%2FcvbYu8R2SOEA%3D

ghost commented 3 years ago

Thanks for this... sadly i'm lost as not a JS or Node guy, mainly just a markdown, html and CSS guy with some Hugo.

I caught a typo in the spelling of ulysses in the last line but still get weird errors. Does the script still work for you? I'm on macOS with node 14.17 and dependencies seem all good. Thanks

emgoto commented 3 years ago

Hi @gjurd, it's hard to say what exactly is the problem without seeing your errors (thanks for pointing out that typo, though).

If you could provide some more details that would be great.

ghost commented 2 years ago

Hi @gjurd, it's hard to say what exactly is the problem without seeing your errors (thanks for pointing out that typo, though).

If you could provide some more details that would be great.

Hey again... sorry for the delay!

Come back to this now and it's worse that I remember. Most of this will be caused by my complete lack of JS and Node knowledge outside of Static websites. What I did today was:

  1. node init
  2. created script and correct the line 56 declaration spelling of ulysses (yea, forgot again!)
  3. installed required nodules with npm install --save MODULENAME commands
  4. ran npm fund
  5. Ran script and all kinds of errors as below. I'm running Node v14.17.3 (the USER_PATH is just for sharing to hide my info)

The errors make no sense to me:

$ node ulysses.js (node:79823) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'match' of undefined at ulysses (/USER_PATH/EmmaGoto/ulysses.js:22:23) at Object.<anonymous> (/USER_PATH/EmmaGoto/ulysses.js:57:1) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) at internal/main/run_main_module.js:17:47

I realize I need to learn node and JS but any thoughts on my train wreck code 😁

emgoto commented 2 years ago

@gjurd

From this error:

Cannot read property 'match' of undefined at ulysses (/USER_PATH/EmmaGoto/ulysses.js:22:23

I would take a guess that this line in the code is failing:

const slug = file.match(/\/([^\/]+).textbundle/)[1];

And what the error is saying is that .match() isn't working because file is undefined. So then the next steps would be to investigate why it is undefined. In this case, it's probably failing on this line:

join(process.cwd(), 'scripts', '**', '*.textbundle'),

What this is doing is it's looking for any .textbundle files that live inside my repository's scripts folder, and in your case, it probably isn't finding anything. This is pretty specific to my use-case - I just export my Ulysses files to the same folder as where I keep my scripts, so you may have to change this code a bit to get it working for you. eg. just do

join(process.cwd(), '**', '*.textbundle'),

Feel free to DM me on twitter (emma_goto) if you have any more questions!

ghost commented 2 years ago

Thanks Emma Will continue on Twitter but I died with cringe face when I saw I missed that path: "/USER_PATH/EmmaGoto/". Such a basic error to miss, apologies.

peterkaosa commented 2 years ago

Just out of interest: why don't you simply export your post from Ulysses to .md? Or the way I used to do it was connect my Ulyssys to my blog roll. Worked fine with WordPress for me.

quantumgardener commented 1 year ago

Hi Emma,

Maybe I'm going blind but I can't see a TextBundle export option.

David

quantumgardener commented 1 year ago

I've found it now. Wasn't an obvious selection. Bookmarking your page for when I need it in the future. Thanks.