googleworkspace / md2googleslides

Generate Google Slides from markdown
Apache License 2.0
4.47k stars 283 forks source link

Document the headless mode option (-n or --no-browser) #37

Open zenmaster24 opened 5 years ago

zenmaster24 commented 5 years ago

Hi,

If I want to run this in a container, it wants to authorize via a browser which is obviously not going to work. How can I authorize otherwise? Copying ~/.credentials/md2gslides.json with correct data?

Thanks

erickoledadevrel commented 5 years ago

There is a headless mode command line flag (-n or --no-browser) you can use, which will print the URLs out but not attempt to open a web browser. This isn't documented in the README however, so changing this to a feature request to document it.

zenmaster24 commented 5 years ago

ok cool - is there anyway to pre-auth the app? cos even if you use the -n arg, you get asked to authorise the app and enter in the code. eg:

sudo docker logs 70881ae9a5bb
Authorize this app by visiting this url: 
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fpresentations&login_hint=default&response_type=code&client_id=<client_id_string>
Enter the code here: % 

I am also using this as slides.md and getting a #comment error?:

# This is a title slide
## Your name here
---
# This is a section title
---
# Section title & body slide
## This is a subtitle
This is the body
---
# Title & body slide
This is the slide body.
---
# This is the main point {.big}
---
# 100% {.big}
This is the body
---
# Two column layout
This is the left column
{.column}
This is the right column
---
# Slides can have images
![](https://placekitten.com/900/900)
---
# Slides can have background images
![](https://placekitten.com/1600/900){.background}
---
# Slides can have videos
@[youtube](MG8KADiRbOU)
---
# Slide title
![](https://placekitten.com/1600/900){.background}
<!--
These are speaker notes.
-->
---
**Bold**, *italics*, and ~~strikethrough~~ may be used.

Ordered lists:
1. Item 1
1. Item 2
  1. Item 2.1

Unordered lists:
* Item 1
* Item 2
  * Item 2.1
---
### I :heart: cats
:heart_eyes_cat:
---
### Hello World
```javascript
console.log('Hello world');

Error:

Unable to generate slides: Error: Unsupported inline HTML element: #comment
    at inlineTokenRules.html_inline (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:274:23)
    at processMarkdownToken (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:84:9)
    at inlineTokenRules.inline (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:229:13)
    at processMarkdownToken (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:84:9)
    at processTokens (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:73:9)
    at extractSlides (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:61:5)
    at SlideGenerator.generateFromMarkdown (/usr/lib/node_modules/md2gslides/lib/slide_generator.js:86:27)
    at generateSlides (/usr/lib/node_modules/md2gslides/bin/md2gslides.js:179:27)
    at tryCallOne (/usr/lib/node_modules/md2gslides/node_modules/promise/lib/core.js:37:12)
    at /usr/lib/node_modules/md2gslides/node_modules/promise/lib/core.js:123:15
    at flush (/usr/lib/node_modules/md2gslides/node_modules/asap/raw.js:50:29)
    at process._tickCallback (internal/process/next_tick.js:61:11)
Error: Unsupported inline HTML element: #comment
    at inlineTokenRules.html_inline (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:274:23)
    at processMarkdownToken (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:84:9)
    at inlineTokenRules.inline (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:229:13)
    at processMarkdownToken (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:84:9)
    at processTokens (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:73:9)
    at extractSlides (/usr/lib/node_modules/md2gslides/lib/extract_slides.js:61:5)
    at SlideGenerator.generateFromMarkdown (/usr/lib/node_modules/md2gslides/lib/slide_generator.js:86:27)
    at generateSlides (/usr/lib/node_modules/md2gslides/bin/md2gslides.js:179:27)
    at tryCallOne (/usr/lib/node_modules/md2gslides/node_modules/promise/lib/core.js:37:12)
    at /usr/lib/node_modules/md2gslides/node_modules/promise/lib/core.js:123:15
    at flush (/usr/lib/node_modules/md2gslides/node_modules/asap/raw.js:50:29)
    at process._tickCallback (internal/process/next_tick.js:61:11)
{}

I just wanted to test the feature of md2googleslides

erickoledadevrel commented 5 years ago

You should only need to authorize the tool once, and then it will re-use your tokens for later runs. Please open a new issue about the comment.

zenmaster24 commented 5 years ago

You should only need to authorize the tool once, and then it will re-use your tokens for later runs.

Not for docker runs. Would you copy the credentials file as part of the container build, or something else?

erickoledadevrel commented 5 years ago

Yes, I guess you'd need to copy the saved credentials file along with the build.

bwplotka commented 4 years ago

I believe this is solved and can be closed, I can see proper flag help in https://github.com/gsuitedevs/md2googleslides/blob/master/bin/md2gslides.js#L65 :hugs: