From the course: Google Apps Script for JavaScript Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating the Markdown converter

Creating the Markdown converter - Google Docs Tutorial

From the course: Google Apps Script for JavaScript Developers

Start my 1-month free trial

Creating the Markdown converter

- [Instructor] Now it's time for us to create our Markdown converter. Let's go back into our script project, and we're going to create a new script. Let's call this Doc2Markdown. (typing) Let's rename the default function to convertToMarkdown. We're also going to need to pass in a reference of the document that we want to convert. Let's save this and go back into our main script. Previously, we had set up the active section and pulled the text out of it inside of our main function. Let's go ahead and select these two lines of code and cut them out of the script. We're going to paste them into our Doc2Markdown script inside of the convertToMarkdown method. We'll also need to return the text, which will represent our markdown, once we begin the conversion process. Save the script, and go back into Main. Now, let's go ahead and create a new variable called markdown. We're going to set this equal to the convertToMarkdown method, and we're going to pass in our doc. Let's also copy the…

Contents