Google Docs Markdown



Google

Sep 05, 2018 Copy this code and go to your document on Google Docs. In the menu you call the tools and then the script editor: Clean up the file in the script editor first and give it the code from the. Apr 09, 2021 Bookmarked A Google Docs for Markdown (Glitch Blog) From idea to code in seconds, build and learn alongside the most creative coders on the Web Anil Dash discusses the potential to create a group-edited collection of Markdown files using Glitch, what can be described as ‘ Google Docs for Markdown’.

POST

Author: Alan Richardson

I want to collaborate with people on Markdown based writing. Google Docs is a great collaborative writing environment. But it keeps adding formatting when I don’t want it to, so how can I use it to edit markdown. In this post I will tell you how to do that.

Cutting to the chase: type in your markdown and press ctrl+z everytime Google Doc adds formatting, save as .txt

Markdown is a text based writing markup language, which you feed into other programs to convert to pdf, html, slides, etc.

I use it all the time. Running the Markdown through Marp to create slides, Dillinger.io for adhoc documents, and Pandoc for more formal documents.

Google classroom

I mainly use a subset of markdown.

When I am creating slides I only really use the following constructs

If Google docs can allow me to create the above then I would be fine.

There are Chrome plugins that claim to help with this. But I really want a no-addon approach.

What are the Google Docs Output options?

The following options look most promising.

  • Web Page (.html, zipped)
  • Plain text (.txt)

What happens if I create a doc and export as html?

I created a Google Doc - formatted as though it was the Markdown rendering.

I exported the .html as a zip from Google Docs.

I tried to use online services to convert HTML to Markdown.

It didn’t completely work.

  • Dillinger.io
    • links are Googlised
    • bold and italics are missing
    • no image marker

Bonus: I learned that a horizontal line is also *** and not just ---

What happens if I create a doc and export as text?

Using the same Google Doc, I tried to export as text.

What works?

  • horizontal lines
  • links that are .com
  • bulleted lists

Nothing else.

But that defeats the point

The biggest pain of using Google Docs as a Markdown editor is the continual reformatting of what you type into formatted text. But if you get used to typing ctrl+z every time this happens then you will be fine. I experience a similar problem when I type Markdown directly into Evernote, although it doesn’t reformat the text quite as much.

  • bullets auto convert into bullets
    • this exports OK
    • or ctrl+z to remove formatting
  • images you will have to export as html
    • save as zipped html and find the images
    • publish as html and save the images
  • bold works fine
  • underscore works fine
  • end comments converts into a unicode graphic - cntrl+z fixes it

Save as .txt.

  • Paste the contents of .txt into Dillinger.io.
  • Open the .txt file into Dillinger.io.
  • Open the .txt file in Marp

Since I’m collaborating on a set of slides. Opening in Marp is my preferred option since I can see the actual slides generated.

Google Docs Markdown

It is possible to use Google Docs as a markdown editor, just remember to use ctrl+z a lot.

I’m collaborating with someone who does not really know Markdown. So at the start of our shared Google Doc I have a comment which has these instructions in it.

You just have to take a little care. And since you get to edit as you share. That’s a price that seems fair.

  • Related:
Please enable JavaScript to view the comments powered by Disqus.comments powered by Disqus

Professors across the country are scrambling to tidy up their syllabi. But how to best share them with students? I’ll be publishing my “Digital Storytelling and Social Media” syllabus on Github using a simple website publishing format called RMarkdown. The good news is, if you can type your syllabus into Google Docs, you can build a site like this:

The following tutorial walks you through how to convert a Google Doc into RMarkdown and then upload it to a Github repository and then host it live on Github Pages. Mine can be found here: aleszu.github.io/digisoc.

Export your Google Doc to Markdown

Markdown

Markdown is simple syntax for documents. Headers look like this # Title and links like [click me](http://websi.te).

To convert your Google Doc into Markdown, copy this gdocs2md script from Github user Renato Mangini and insert it into your Google Doc’s script library by opening your Google Doc, navigating over to Tools -> Script editor… and then pasting the script into the Code.gs field like this:

Save the script as ConvertToMarkdown. It will ask you for permission to access your Google Docs and permission to send you an email. Next, run the script by clicking the triangular “play” button or selecting Run -> ConvertToMarkdown. The script will send you an email with a subject line that starts with [MARKDOWN_MAKER] followed by your document name.

Download the markdown file and open it in a text editor like Sublime Text.

Install R Studio and the rmarkdown package

Now that you have your syllabus – or document – in markdown, you can begin pasting it into RMarkdown files. Download and open R Studio and install the “rmarkdown” package by going to Tools -> Install Packages… and looking for rmarkdown. Alternatively, type install.packages(“rmarkdown”) into the Console and hit return.

Create website pages in R Studio

Next, create a file called index.Rmd by going to File -> New File -> R Markdown… and selecting HTML after putting in a title and author.

The top of your index.Rmd file must follow this format:

I’ve added the following:

To include a table of contents and spice up the site with nice typography using the cosmo theme, I’ve included some extra information including toc: true (meaning yes, I want a table of contents), toc_depth: 2 (meaning only # headlines and ## subheds will show up in the table of contents) and toc_float: true (meaning the table of contents will stay put as I scroll down).

Note: cosmo is cool. But you can play with themes and colors by consulting the RMarkdown HTML page. Below, some highlights:

Preview your index page

Using the Knit button or by clicking File -> Knit Document, you can preview your webpage in R Studio. Looking good!

Create additional pages

For my weekly schedule and assignments, I wanted to create additional pages. Open new .Rmd documents and paste in the corresponding markdown text. Save as schedule.Rmd and assignments.Rmd, for example. Make sure these pages have headers, too.

Creating the _site.yml file

RMarkdown websites require a _site.yml file to organize the rest of the files and add a navigation bar. In your text editor, create and save a _site.yml file following this format to name your website and include a navbar:

The output_dir: “.” is required if you want to host this website on Github pages. We do, so make sure to include it!

Notice the navbar. You can link to outside URLs or to the other pages you’ve built. Make sure to use .html. (In the next step, we’ll convert our pages from .Rmd to .html files).

Build your pages

Once you’ve finished editing your .Rmd files, you can build them into .html files. Make sure the .Rmd and .yml files are all in the same directory.

In R Studio, go to the Console pane in the bottom-left and type rmarkdown::render(“index.Rmd”) and click enter. Do the same for rmarkdown::render(“assignments.Rmd”) and rmarkdown::render(“schedule.Rmd”) or whatever you’ve named your other pages. The files should be processed by R Studio and end up in the same directory you’ve saved the .Rmd and .yml files. Open the .html files in an internet browser to double-check them.

Push the files to Github

Log into Github and create a new repository for your webpage. Make sure to initialize the repository with a README file.

Google

Google Sheets

Once you’re in your new repository, click Upload files:

Drag and drop in your files and click Commit changes:

Alternatively, you could use Github Desktop or the command line to commit files to your repository.

Add a .nojekyll file to repo

As the RMarkdown websites page explains, you must add a file named .nojekyll “to your site source code directory” because “this tells GitHub Pages to not process your site with the Jekyll engine.”

Next to Upload files, click Create new file. Name it .nojekyll and click Commit new file at the bottom of the page.

Publish your repo as a Github page

Google Docs Markdown App

Finally, head to the Settings tab of your repository.

Scroll down to the Github Pages section and click None. Select master branch as your Source and then hit Save.

Now, navigate to {username}.github.io/{reponame} and your website should be live! Mine is at aleszu.github.io/digisoc/.

Happy coding!

Google Docs Markdown Spreadsheet

Update: Thanks Ryan Cordell for writing a script in R that “automates the rendering of HTML files from Rmd and automatically generates the page menu for the site, eliminating much duplicative work.”