2020. 3. 22. 21:21ㆍ카테고리 없음
I love Google Docs. I write notes, essays, correspondences, invoices, journal entries, business ideas, planning documents- everything on there. I also love the markdown format. I'm a programmer so sometimes I'm in my editor and just want to write things in markdown instead of going to Google Docs.
However, when I save my markdown files in Google Drive, I can't preview them there, which is extremely disruptive to my workflow. Being able to preview markdown files in Google Drive would be a huge improvement. Is there any way to enjoy the benefits of both Google Docs and markdown?
Or are these writing platforms largely incompatible? Any elegant solutions I'm not thinking of? A Google Docs document encodes everything in 'elements' within the Kix editor that it's all based on (it's closed source as basically this is the big trade secret, with which anyone else could run their own Docs service - which is a shame imo).
Preview Of Imported Google Docs
You can access these elements with Google Apps Script, a variant of Javascript - but writing Markdown from the elements isn't as straightforward as you'd think (you have to essentially implement a markdown parser in Apps Script). When I came to do this earlier in the year there were dozens of forks of Renato Mangini's ' repo, but he seemed to have stopped fielding pull requests, and over the period of a few years forks had appeared that were far better than others. I went through many of these in the tree and put the best into a new package, which also generates HTML mixed with the markdown for elements Google Docs supports such as superscript and subscript elements (which markdown has no way of representing). Even incorporating the best of others' edits, the parsing needed work, and I'm confident that this is the best available for the job at present. Script available on GitHub with installation instructions: I also worked on adding in the most important feature to such a script - user features - providing the markdown in a pop-up within Google Docs rather than saving to file (I think the original was batch saving for entire folders, which is not suitable for my document-drafting needs, or how I use Google Docs at all).
I'd like to suggest it be a single more sophisticated project for interested developers to collaborate on (or at least suggest features for) rather than everyone forking off scripts of various quality, when we're likely working to the same aims. As well as reducing duplication of effort, the Google Docs policy for creation of 'add-ons' that to be published (and therefore 'installable' rather than needing to be loaded for each document in a slightly awkward manner). The add-on must be fully functional — it can't be a “work in progress.”. The script has been tested with multiple active users. Obviously if you wanted a 'pure' markdown then either switch off these features (the code is there to fork) or just don't use sub/superscripts, etc. It wouldn't be too difficult to add personalised settings to such a script if it matures as an add-on, if there's significant interest. You can convert a Markdown document to HTML, and copy/paste the HTML page (not the source) into a Google Drive document.
It will retain most of the formatting including headings, lists, links, bold/italic/underline. The font, margins, and font sizes will not match the Google Drive defaults, and will look 'out of place' compared to standard Google Drive documents. Applying a custom CSS file to the HTML document will solve this, making the document look very similar. I'm not sure about the other direction, converting Google Drive documents to Markdown. It may be possible to export to HTML and use an HTML to Markdown converter. Does a good job of converting Google documents to markdown, retaining headers, lists, tables, italics, bold, links and images.
I use it to allow shared editing of documents, then export to markdown. Some care does need to be taken to use formatting in the Google document that maps well to markdown, but this isn't particularly difficult. I've also extended the script to support exporting an entire folder of documents to a new 'export' folder on Google Drive, and to slightly improve handling of italic and bold formatting,. Assuming that once you're done making a document in markdown you want to convert it into a true google document (as opposed to being able to preview the document in the google drive web interface and continue editing in markdown syntax) so that others unfamiliar with markdown can collaborate I've found the following fairly quick:. Create your mark down wherever's convenient.
When done export to the browser. Copy the resulting text from the browser. Paste into a new Google Doc Google docs is ready to have HTML pasted in so it'll preserve all the headings, spacing, lists, and other formats. Of course this only makes sense if you just want to personally work in markdown, but collaborate with others in a regular google doc.
You can suggest changes to a document without changing the original text. If the owner approves your suggestions, they replace the original text. Suggest changes to a file.
On your computer, open a document at. In the top right, if you don’t see 'Suggesting,' click Editing Suggesting. If you don’t see this option, ask the file owner to. Edit the document. You’ll see your change in a new color. Anything you delete will be crossed out. To add more detail, click your suggestion and type a comment.
Then click Reply. The owner of the file will get an email about your suggestions and can decide whether to keep them. Learn how to. Accept or reject suggestions.