mangini / gdocs2md

Convert a Google Drive Document to the Markdown format, suitable for publishing.
Apache License 2.0
2.66k stars 621 forks source link

Was working/now error on line 87 getNumChildren #58

Open NancyHarvey opened 6 years ago

NancyHarvey commented 6 years ago

See error image

The script worked great for a bunch of docs I converted last month, now I'm getting this error message and don't know how to fix.

NancyHarvey commented 6 years ago

@mangini - hi - any chance you can help me with this, please? I have a large document I need to convert and this is hanging me up. TIA

evbacher commented 6 years ago

Hi Nancy -- I won't speak for Renato, but I've been putting my side-project energies into a Docs add-on that extends the work Renato started. See https://github.com/evbacher/gd2md-html/wiki for information about gd2md-html. We've been using a version of this for a few years, and I released an external version a few months ago.

NancyHarvey commented 6 years ago

@evbacher - thanks so much. I'll check it out!

miro-ka commented 6 years ago

This has nothing to do with gdocs2md, but this is working for me (just copy it to your editor and you get markdown)

screen shot 2018-05-13 at 22 52 52
codingthat commented 6 years ago

Anyone else following along can have it skip unsupported stuff (which sometimes might not be noticeable at all) by changing line 87 to: if (!element.getNumChildren || element.getNumChildren()==0) {

codingthat commented 6 years ago

Better yet:

  if (!element.getNumChildren) {
    // just in case we would cut something whose absence wouldn't be obvious...
    return {"text": "<!-- There was something here that couldn't be converted.  It may be nothing, but you should compare this spot with the original to make sure nothing is missing.  Either way, delete this comment afterward. -->"};
  }  
  if (element.getNumChildren()==0) {
    return null;
  }  
goose-life commented 3 years ago

Out of interest, I used the above substitution (thanks so much @codingthat), and the warning comment printed where a column break had been inserted in the google doc to make subsequent pages landscape.