gdocs2md icon indicating copy to clipboard operation
gdocs2md copied to clipboard

Was working/now error on line 87 getNumChildren

Open NancyHarvey opened this issue 7 years ago • 7 comments

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 avatar Nov 06 '17 21:11 NancyHarvey

@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

NancyHarvey avatar Nov 20 '17 19:11 NancyHarvey

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.

evbacher avatar Nov 20 '17 21:11 evbacher

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

NancyHarvey avatar Nov 21 '17 23:11 NancyHarvey

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

miro-ka avatar May 13 '18 20:05 miro-ka

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 avatar Jun 25 '18 16:06 codingthat

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;
  }  

codingthat avatar Jun 25 '18 16:06 codingthat

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.

goose-life avatar Jun 22 '21 18:06 goose-life