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.

Formating text blocks

Formating text blocks - Google Docs Tutorial

From the course: Google Apps Script for JavaScript Developers

Start my 1-month free trial

Formating text blocks

- [Instructor] Now that we're generating out clean markdown, it's time for us to go back in and finalize some of the formatting details. The first thing we're going to do is try to indentify where we have code blocks inside of our markdown. If we look inside of our Google Doc file, you'll see that we have certain areas of code nested inside of our document, and their font is set to Courier New. We're going to format them in a markdown friendly way. Let's go back to our convert to markdown project and go into our Doc2Markdown script. Towards the bottom of our Doc2Markdown script, we already have a condition where we test to see if our element is of type text. Here, we're just assuming all text is created equal, but what we want to do is go ahead and test to see what the font type is of that text before we process it. Let's add a new variable called font. Here, we're going to call the element.getFontFamily and next, we're going to write a condition to test if the font is equal to…

Contents