Skip to content

Commit

Permalink
using marked.js
Browse files Browse the repository at this point in the history
  • Loading branch information
arturadib committed Aug 12, 2012
1 parent 218f7ed commit 48816b7
Show file tree
Hide file tree
Showing 10 changed files with 384 additions and 252 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Strapdown - Beautifully simple Markdown documentation

Strapdown provides conveninent CSS and JavaScript to generate Bootstrap-beautiful Markdown documents directly in the browser. You write one simple HTML file, and you're done.

For a user guide, please visit:

+ http://strapdownnow.com

## Contributor guide

You will need Node.js (>0.6.x) and CoffeeScript to generate the bundles:

```
$ npm install
$ coffee bundle
```
9 changes: 9 additions & 0 deletions assets/strapdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ This chunk is to fix Bootstrap so that Markdown looks good

body {
margin-top: 60px;
margin-bottom: 30px;
font-size: 15px;
}

Expand All @@ -82,3 +83,11 @@ pre {
margin-bottom: 20px;
}

#markdown {
display: none;
}

img {
margin-top:10px;
margin-bottom:10px;
}
220 changes: 154 additions & 66 deletions assets/strapdown.js

Large diffs are not rendered by default.

Binary file added bootswatch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 1 addition & 6 deletions bundle.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@ if not test '-d', buildDir

# JS
bundle = ''
bundle += (cat 'vendor/showdown.min.js') + '\n'
bundle += (cat 'vendor/marked.min.js') + '\n'
bundle += (cat 'vendor/prettify.min.js') + '\n'
bundle += (cat 'src/strapdown.js') + '\n'
bundle.to buildDir + '/strapdown.js'

# CSS
bundle = ''
bundle += (cat 'src/strapdown.css') + '\n'
bundle.to buildDir + '/strapdown.css'

console.log "Bundles generated in #{buildDir}/"
82 changes: 50 additions & 32 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,51 +1,69 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

<!--====================================================================
Step 1: Change the title
====================================================================== -->
<title>Strapdown - Beautifully simple Markdown documentation</title>

<!--====================================================================
Step 2: Choose the theme
====================================================================== -->
<link href="assets/themes/united.min.css" rel="stylesheet">

<link href="assets/strapdown.css" rel="stylesheet">
<meta charset="utf-8">
<title>Strapdown - Hassle-free Markdown documentation</title>
<link href="assets/themes/united.min.css" rel="stylesheet">
<link href="assets/strapdown.css" rel="stylesheet">
</head>
<body>

<!--====================================================================
Step 3: Write your Markdown
====================================================================== -->
<textarea id="markdown" style="display:none;">
<textarea id="markdown">
# Strapdown

This is something else
Strapdown lets you instantly create Bootstrap-themed Markdown documents that are rendered directly in the browser - no server-side compilation necessary. Use it to document your projects, create tutorials, home pages, etc. (This very page was written with Strapdown).

### Using it

Simply copy and paste the HTML code below and modify the three indicated steps - can't get any easier than this:

```html
<script>alert('hi')</script>
```
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

```coffeescript
class Animal
constructor: (@name) ->
move: (meters, loc) ->
alert @name + " moved " + meters + "m."
travel: (path...) ->
for place in path
@move place.distance, place.location
<!-- Step 1: Change title -->
<title>Hello Strapdown</title>

<!-- Step 2: Choose a theme -->
<link href="assets/themes/united.min.css" rel="stylesheet">

<link href="assets/strapdown.css" rel="stylesheet">
</head>
<body>

<!-- Step 3: Write your Markdown! -->
<xmp id="markdown">
# Hello, from Strapdown

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.

</xmp>
<script src="assets/strapdown.js"></script>
</body>
```

And this too
### Themes

Themes from [Bootswatch.com](http://bootswatch.com) are included in `assets/` for your convenience. Simply replace the appropriate CSS `<link>` to point to one of the included themes:

![Bootswatch](bootswatch.png)

### Features

+ Search-engine friendly
+ Zero installs
+ Github-style syntax highlighting
+ Themeable

## Features
### Caveats

+ Content is search-engine friendly
+ Easily skinnable: Choose from several provided themes
Because Strapdown uses an `<xmp>` element to wrap your Markdown, your Markdown can't contain the closing tag `</xmp>`. That's the only tag that needs to be avoided.

</textarea>
<script src="assets/strapdown.js"></script>
Expand Down
83 changes: 0 additions & 83 deletions src/strapdown.css

This file was deleted.

5 changes: 2 additions & 3 deletions src/strapdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ var title = titleEl.innerHTML;

document.getElementById('headline').innerHTML = title;

// Generate Markdown
var converter = new Showdown.converter();
var html = converter.makeHtml(markdown);
// // Generate Markdown
var html = marked(markdown);
document.getElementById('content').innerHTML = html;

// Prettify
Expand Down
Loading

0 comments on commit 48816b7

Please sign in to comment.