Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvments and refactoring #25

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
91b3126
Update documentation.
jacksonicson May 3, 2014
e6df0d4
Added me as a contributor.
jacksonicson May 3, 2014
82cc417
Fixed error in equation generator.
jacksonicson May 3, 2014
c1bc360
Fixed error in recursion. Did not attach returned string.
jacksonicson May 3, 2014
6403e16
Go upwards until the document root if scanning for an equation.
jacksonicson May 3, 2014
9098ef8
No double line breaks between item lists.
jacksonicson May 4, 2014
2ec4cc4
Reintegrated support to send converted MD as an email.
jacksonicson May 9, 2014
5a38ec2
Changed menu naming
jacksonicson May 9, 2014
33c26ba
Added UI menus.
jacksonicson May 9, 2014
209897e
Update README.md
jacksonicson May 9, 2014
47d0c8e
Update README.md
jacksonicson May 9, 2014
5d867f5
Change table header separator from = to -
jacksonicson May 9, 2014
9c54e00
Redesigned core functionality in a recursive approach.
jacksonicson May 9, 2014
2833381
Removed previous implementation.
jacksonicson May 9, 2014
4cc40e8
Added support for more element types.
jacksonicson May 10, 2014
2c3539f
Update README.md
jacksonicson May 10, 2014
6bc4f96
Source code support
jacksonicson May 10, 2014
3fa51cf
Update README.md
jacksonicson May 10, 2014
31865db
Update README.md
jacksonicson May 10, 2014
1605fbb
Update README.md
jacksonicson May 10, 2014
1b16396
Fixed invalid method name
jacksonicson May 10, 2014
2ea56ef
Fixed error in prev and next pointers.
jacksonicson May 10, 2014
dadf379
Catch more error conditions.
jacksonicson May 10, 2014
dd92587
Added screenshot
jacksonicson May 10, 2014
11788ca
Update README.md
jacksonicson May 10, 2014
6f59392
Documentation update
jacksonicson May 10, 2014
af9be0c
Do not include empty header and footer regions
jacksonicson May 10, 2014
5f269d8
Ensure spaces before and after MD formattings
jacksonicson May 10, 2014
28588ca
Fixed list counters
jacksonicson Jul 6, 2014
8bfd895
Added break statement to fix numbered list counter
jacksonicson Jul 6, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ gdocs2md

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

![Screenshot Google Docs with gdocs2md](markdown.png)

## Usage

* Adding this script to your doc (once per doc):
* Open your Google Drive document (http://drive.google.com)
* Tools -> Script Manager > New
* Select "Blank Project", then paste this code in and save.
* Clear the myFunction() default empty function and paste the contents of [converttomarkdown.gapps](https://raw.github.com/mangini/gdocs2md/master/converttomarkdown.gapps) into the code editor
* Clear the myFunction() default empty function and paste the contents of `converttomarkdown.gapps` into the code editor
* File -> Save

* Running the script (run as many times as you want):
- Tools > Script Manager
- Select "ConvertToMarkdown" function.
- Click Run button (First run will require you to authorize it. Authorize and run again)
- Converted doc with images attached will be emailed to you. Subject will be "[MARKDOWN_MAKER]...".
- Markdown > Export File (Creates a new folder `target` in the same directory as the document. Markdown and image files are stored in it. A warning is generated if a `target` directory already exists)
- Markdown > Export Email (Sends you an email with the Markdown and image files)
- Markdown > Latex Equation (Put your cursor on a equation and run the script. It will output the LaTex formatting in a dialog)


## Interpreted formats
Expand All @@ -30,22 +31,26 @@ A simple Google Apps script to convert a properly formatted Google Drive Documen
* 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 `<div class="whateverclassnameyouwant"></div>`
* 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>`
* 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`


* Drawings:
* not supported - there seems to be no API function to export a drawing as a rasterized or vector image.
* Equations:
* Equations are converted to LaTex equations and surrounded by ``$`` signs
* Table of contents:
* Is replaced by `[[TOC]]`
* Horizontal line:
* Inserts a `---`
* Header/Footer:
* Extracts text with all formattings and inserts it at the top and bottom of the markdown document, seperated by `---`.
* Tables:
* Converted to Markdown tables following GitHub Markdown syntax. Formatting within cells gets transferred.
* Source code:
* Fenced code blocks are started by three back-ticks and a string and ended by three back-ticks. If such a fenced code block is detected, single line break is used within it.

## CONTRIBUTORS

* Renato Mangini - [G+](//google.com/+renatomangini) - [Github](//github.com/mangini)
* Ed Bacher - [G+](//plus.google.com/106923847899206957842) - [Github](//github.com/evbacher)
* Andreas Wolke - [G+](//plus.google.com/+AndreasWolke) - [Github](//github.com/jacksonicson)

## LICENSE

Expand Down
Loading