• Stars
    star
    286
  • Rank 143,809 (Top 3 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Convert a Google Drive Document to a markdown.

gdocs2md-html

A simple Google Apps script to convert a properly formatted Google Drive Document to the markdown (.md) format.

Brief installation

  • Adding this script to your doc (once per doc):
    • Open your Google Drive document (http://drive.google.com)
    • Tools -> Script Editor > Create script for blank project
    • Clear the default Code.gs file and paste the contents of exportmd.gs into the code editor
    • File -> Save (or Ctrl/⌘ + S)
    • When prompted enter new project name for 'Untitled project', e.g. 'gdocs2md'

Note: now needs advanced Drive API enabling in Script Editor on first use (just a few clicks from the menu).

  • Resources menu β‡’ Advanced Google Services, enable the Drive API by clicking the switch next to its name
  • The link below the API list to the dev console project page for the script you're editing will become clickable
    • At the link, again click the on/off switch on the advanced Drive API setting
  • If the script doesn't refresh automatically at this point, hit Ctrl/Cmd + S to save it, select onInstall from the functions dropdown menu at the top of the page and to the left of that click the play icon to run.
  • If you go back to your document a Markdown menu will be sitting there, with a dropdown to Export markdown > View in browser

Menu added to Google Docs. Note: customisation/comments features work in progress, see script

When you finish writing, the markdown (via the View in browser button) can be pasted straight into a suitable publisher.

  • HTML tags are supported in markdown, but feel free to add your own hooks in the source code, or modify the existing ones.
  • Feel free to change the hooks yourself - e.g. the --- src ... --- fences could demarcate <blockquote> / </blockquote> tags - you're free to edit the script when installing.

Related tips/tricks:

Interpreted formats

  • Text:
    • paragraphs are separated by two newlines
    • text styled as heading 1, 2, 3, etc is converted to Markdown heading: #, ##, ###, etc
    • text formatted with Courier New is backquoted: text
    • links are converted to MD format: [anchortext](url)
    • indented paragraphs are rendered as > (blockquote) blocks
    • sub- and superscript text is tagged appropriately (<sup>/<sub>)
  • Lists:
    • Numbered lists are converted correctly, including nested lists
    • bullet lists are converted to "*" Markdown format appropriately, including nested lists
  • Images:
    • images are correctly extracted and sent as attachments
  • Blocks:
    • Table of contents is replaced by [[TOC]]
    • blocks of text delimited by "--- class whateverclassnameyouwant" and "---" are converted to <pre class="whateverclassnameyouwant"></pre>
    • Source code:
      • UPDATED: blocks of text delimited by "--- source code" or "--- src" and "---" are converted to <pre></pre>
      • NEW: blocks of text delimited by "--- source pretty" or "--- srcp" and "---" are converted to <pre class="prettyprint"></pre>
      • NEW: blocks of text delimited by "--- gloss" and "---" are converted to <pre class="glossary"></pre>
      • NEW: blocks of text delimited by "--- fig-cap" and "---" are converted to <pre class="fig-cap"></pre> (figure captions)
      • (feel free to change these for your own needs)
    • Tables:
      • NEW: Simple <table> processing
  • "--- jsperf <testID>" is replaced by an iframe that shows an interactive chart of a JSPerf test. The <testID> is the last part of the URL of the Browserscope anchor in your JSPerf test. Something like "agt1YS1wcm9maWxlcnINCxIEVGVzdBjlm_EQDA" in the URL http://www.browserscope.org/user/tests/table/agt1YS1wcm9maWxlcnINCxIEVGVzdBjlm_EQDA

CONTRIBUTORS

LICENSE

Use this script at your will, on any document you want and for any purpose, commercial or not. The MarkDown files generated by this script are not considered derivative work and don't require any attribution to the owners of this script.

If you want to modify and redistribute the script (not the converted documents - those are yours), just keep a reference to this repo or to the license info below:

Copyright 2013 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

deforum-stable-diffusion

Refactor of the Deforum Stable Diffusion notebook (featuring video_init) https://colab.research.google.com/github/deforum/stable-diffusion/blob/main/Deforum_Stable_Diffusion.ipynb
Python
97
star
2

devnotes

obscure technical resolutions re: errors, installation quirks, custom setups etc.
89
star
3

page-dewarp

Document image dewarping library using a cubic sheet model
Python
84
star
4

tabsave

Super simple Chrome extension to save all files in open tabs (e.g. PDFs)
JavaScript
61
star
5

crawley-r-statistics-book-notes

Notes on Michael Crawley's "Introduction to Statistics using R" book (Wiley, 2nd edition)
R
8
star
6

range-streams

Streaming range requests in Python
Python
6
star
7

copermut

Web project on information theory, graph patterns, permutations, and recombinations
6
star
8

watir-paper-scanner

Web scraper to pull metadata (specifically corresponding author) from pages where unavailable through Pubmed's eUtils XML file. Work in progress 2013 / abandoned in 2014 for more useful projects.
Ruby
5
star
9

OpenResearchGlossary

Website for the Open Research Glossary (currently at http://www.righttoresearch.org/resources/OpenResearchGlossary/index.shtml)
JavaScript
5
star
10

ensembl-assembly-exceptions

Tabulated mappings of Homo sapiens and Mus musculus genome "assembly exceptions" to their location in core Ensembl database releases
4
star
11

ProNTo

ProNTo: Proteomics eNzymology Toolkit
Perl
3
star
12

scholaRdaemon

'Bot' R code to parse Google Scholar Alerts emails and send individual papers to Twitter
R
3
star
13

beeb

A modern interface to the BBC Sounds radio catalogue
Python
3
star
14

tubeulator

TfL open data interface library
Python
2
star
15

sphinx-sub

Automatic video subtitle generation
Python
2
star
16

refactory

Refactor utility with patterns composed of validated AST rules
Python
2
star
17

waterdown

Detecting, reconstructing, and masking image watermarks with numpy
Python
2
star
18

talk-transcripts

Transcripts of scientific talks
2
star
19

pydanttention

Transformer model attention in Pydantic πŸ€–
Python
2
star
20

ordered-powerset

Code to list a powerset in an order that minimises distance between subset elements
Python
2
star
21

feedly-opml

Storing my Feedly OPML and a tabular listing
2
star
22

hiv-phylo-analysis

Phylogenetic analysis of HIV-1 mutation patient sequencing data
R
2
star
23

tomasetti-vogelstein-2015

HTML
2
star
24

flappy-max

First Go app with `gomobile`! πŸƒ
Go
2
star
25

desktops

Linux desktop files, to add applications to start menu
1
star
26

patito-playground

Python
1
star
27

netwalk

Solver for netwalk, reading in image files of game state [under development]
Python
1
star
28

metaphorism

β€œmetaphorism, metaphor-er, metaphorest...” ❦ word games and encoded thought experiments
1
star
29

to-look-into

Links etc. to look into, will probably rename repo, see wiki
1
star
30

searchSpeakerDeck

Search Speaker Deck for talks, sort by date (in absence of a site-wide API)
Go
1
star
31

CropScience

JS to add a "Crop and Print" option to the Acrobat File menu for various bioscience journals.
JavaScript
1
star
32

trumpworld

igraph analysis of Donald Trump's business world
R
1
star
33

embed-n.js

Fun little Javascript program to view PDFs "n-up" in the browser
JavaScript
1
star
34

kpath

Carl Kingsford and Rob Patro. Reference-based compression of short-read sequences using path encoding. Under review (2014). v-0.6.3
Go
1
star
35

pisadl

PDBe PISA download scripts
Python
1
star
36

emoji-liif

Emoji upsampling workflow using LIIF
HTML
1
star
37

wotd

Analysis of WOTD data from Tweets marked #WordOfTheDay from my Twitter account
Python
1
star
38

plage

Paved path refactor engine
Python
1
star
39

d3-step-functions

AWS Step Function visualisation in D3.js
JavaScript
1
star
40

dex

Python
1
star
41

qck

Rubber ducking code with language models
Python
1
star
42

iclr2023-proc

ICLR 2023 conference proc(eedings|essing)
Jupyter Notebook
1
star
43

uk-covid-cases-la

Plot of COVID case rates by local authority
Python
1
star
44

self-serve-py-pkg

Self-service Python package template repo
1
star
45

rehome

Rehome your Python scripts into nice interconnected modules
Python
1
star
46

pdf2up

A small command line utility to generate views of PDFs
Python
1
star
47

pdf2uplambda

An AWS Lambda function for pdf2up
Python
1
star
48

d3-wiring-diagrams

Wiring diagram operad visualisation in D3.js
JavaScript
1
star
49

self-serve-demo

Python package auto-generated via the "lmmx/self-serve-py-pkg" GitHub template repo, with GitLab CI mirroring. Uses the cookiecutter template at lmmx/py-pkg-cc-template
Python
1
star
50

dotfiles_portable

Vim Script
1
star
51

roundel

Modeling journey time on the London tube network using graph representation learning
Python
1
star
52

importopoi

Visualising module connections within a Python package
Python
1
star
53

Micro2metadata

Populating a simple library of scholarly article titles and their RSS feed URLs with bibliographic data, by giving it a structured schema in Javascript.
1
star
54

tfl-api-dataclass-gen

Generate dataclass modules from the TfL API’s Swagger schema
Python
1
star
55

dex-deprecated

Digitising and cross-referencing mathematics textbook index pages
Python
1
star
56

covid19_seir_model

Model of COVID-19 transmission from Sir Roy Anderson's 2020 publication in The Lancet
Python
1
star
57

py-pkg-cc-template

Python
1
star
58

ONS-taser-stats-vis

Data analysis and visualisation using Home Office / Office for National Statistics datasets on police workforce size, population size, and taser use for 43 UK law enforcement territorial regions
R
1
star
59

england-covid-cases-and-admissions

Plots of COVID case rates and hospital admissions for England
Python
1
star
60

waveform

Waveform package that accompanied Amariei et al. (2014) doi: 10.3389/fcell.2014.00040
R
1
star
61

wwdc-21-3d-obj-capture

"TakingPicturesFor3DObjectCapture" sample code from WWDC21 (cloned from artemnovichkov/wwdc21-samplecode)
Swift
1
star
62

pyx-sys

A library for storage and restore of system state in terms of windows and workspaces
Python
1
star
63

mvdef

Move function definitions from one file to another, moving or copying associated import statements along with them
Python
1
star
64

tsutil

Tree-sitter syntax tree printer util
Rust
1
star
65

docs-pkg

Minimal mkdocs template
Python
1
star
66

uv-ws-demo

A simple demo of the new workspaces feature in uv 0.3.0
Python
1
star
67

bisque

Web scraping into structured Pydantic data models 🍲
Python
1
star