Skip to content

Instantly share code, notes, and snippets.

@jonschlinkert
Last active February 3, 2018 05:29
Show Gist options
  • Save jonschlinkert/10c4da2263dc0e5027e798127f433a0d to your computer and use it in GitHub Desktop.
Save jonschlinkert/10c4da2263dc0e5027e798127f433a0d to your computer and use it in GitHub Desktop.

Quickstart

This guide shows you how to get up and running with breakdance, a HTML-to-markdown converter written in javascript for node.js.

Within 2-3 minutes you'll be converting HTML to markdown like a pro!

You can also follow @breakdancejs on twitter

1. Create a test file

Add the contents from the foo.html file in this gist to a local foo.html file.

2. Install breakdance

Install the breakdance CLI with npm:

$ npm install  --global breakdance

3. Convert the file to markdown

From the command line run:

$ bd foo.html

If everything worked properly, you should a foo.md file with similar contents to the foo.md file in this gist.

Bonus 1

Run the following command on the same local foo.html file to only covert the <table> to markdown:

$ bd foo.html --pick table

Bonus 2

To generate only convert the <h2> and the <table> to markdown:

$ bd foo.html --pick h2,table
<h2 id=tables-hover-rows>Hover rows</h2>
<p>Add <code>.table-hover</code> to enable a hover state on table rows within a <code>&lt;tbody&gt;</code>.</p>
<div class=bs-example data-example-id=hoverable-table>
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope=row>1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope=row>2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope=row>3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
</div>

Hover rows

Add .table-hover to enable a hover state on table rows within a <tbody>.

# First Name Last Name Username
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment