Skip to content

Commit

Permalink
docs: cli usage
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Aug 12, 2023
1 parent a5c9d0a commit a174189
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,44 @@ First make sure you have Node.js installed. Then:
```sh
> npm run build
```

…and the built output will be in the `dist` folder.

To start a server with live rebuilding, run:

```sh
> npm start
```

Then point your browser to `http://localhost:9000` to see the site. It will automatically rebuild whenever you change any files.


## CLI Usage

```shell
echo "<b>some html</b>" | npx google-docs-to-markdown
```

However, what you really want it run this after copying text from Google Docs. To do this, you'll need to extract the HTML
on the clipboard. Here's a script to do this:

```shell
swift - <<EOF | npx google-docs-to-markdown | pbcopy
import Cocoa
let type = NSPasteboard.PasteboardType.html
guard let string = NSPasteboard.general.string(forType:type) else {
fputs("Could not find string data of type '\(type)' on the system pasteboard\n", stderr)
exit(1)
}
print(string)
EOF
```

You can then tie this script to a keyboard shortcut if using something like Raycast or another launchbar.

## Contributors

This project is open source, and gets better with the hard work and collaboration of multiple people. Thanks to the following for their contributions:
Expand Down

0 comments on commit a174189

Please sign in to comment.