-
Notifications
You must be signed in to change notification settings - Fork 204
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
Example usage snippits on landing page #293
Open
jasonramirez
wants to merge
6
commits into
gh-pages
Choose a base branch
from
examples
base: gh-pages
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
08fe274
Example usage snippits on landing page
jasonramirez 7afd8d2
Feed hound
jasonramirez 88ffe3e
Feed hound round 2
jasonramirez 0dbc198
Strip custom tags from highlight styles
jasonramirez 2e62754
Feed hound 3
jasonramirez d028f92
Add custom tag, GitHub Flavored Makrdown, include part of README.md
jasonramirez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ exclude: | |
- Gemfile.lock | ||
|
||
markdown: kramdown | ||
kramdown: | ||
input: GFM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<section class="layout layout--light"> | ||
<section class="content content--small"> | ||
<h1>Example Usage</h1> | ||
{% render_markdown example.md %} | ||
<footer class="content__footer"> | ||
<a class="button" href="https://github.com/thoughtbot/ember-cli-rails"> | ||
Full Documentation | ||
</a> | ||
</footer> | ||
</section> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
First, generate the gem's initializer: | ||
|
||
```bash | ||
$ rails generate ember:init | ||
``` | ||
|
||
This will create the following initializer: | ||
|
||
```ruby | ||
# config/initializers/ember.rb | ||
|
||
EmberCli.configure do |c| | ||
c.app :frontend | ||
end | ||
``` | ||
|
||
The initializer assumes that your Ember application exists in | ||
`Rails.root.join("frontend")`. | ||
|
||
If this is not the case, you could | ||
|
||
* move your existing Ember application into `Rails.root.join("frontend")` | ||
* configure `frontend` to look for the Ember application in its current | ||
directory: | ||
|
||
```rb | ||
c.app :frontend, path: "~/projects/my-ember-app" | ||
``` | ||
|
||
* generate a new Ember project: | ||
|
||
```bash | ||
$ ember new frontend --skip-git | ||
``` | ||
|
||
**Initializer options** | ||
|
||
- `name` - this represents the name of the Ember CLI application. | ||
|
||
- `path` - the path where your Ember CLI application is located. The default | ||
value is the name of your app in the Rails root. | ||
|
||
```ruby | ||
EmberCli.configure do |c| | ||
c.app :adminpanel # path defaults to `Rails.root.join("adminpanel")` | ||
c.app :frontend, | ||
path: "/path/to/your/ember-cli-app/on/disk" | ||
end | ||
``` | ||
|
||
Next, install the [ember-cli-rails-addon][addon]: | ||
|
||
```bash | ||
$ cd path/to/frontend | ||
$ ember install ember-cli-rails-addon | ||
``` | ||
|
||
Be sure that the addon's [`MAJOR` and `MINOR` version][semver] matches the gem's | ||
`MAJOR` and `MINOR` versions. | ||
|
||
For instance, if you're using the `0.6.x` version of the gem, specify | ||
`~> 0.6.0` in your Ember app's `package.json`: | ||
|
||
```json | ||
{ | ||
"devDependencies": { | ||
"ember-cli-rails-addon": "~> 0.6.0" | ||
} | ||
} | ||
``` | ||
|
||
[addon]: https://github.com/rondale-sc/ember-cli-rails-addon/ | ||
[semver]: http://semver.org/ | ||
|
||
Next, configure Rails to route requests to the `frontend` Ember application: | ||
|
||
```rb | ||
# config/routes.rb | ||
|
||
Rails.application.routes.draw do | ||
mount_ember_app :frontend, to: "/" | ||
end | ||
``` | ||
|
||
Ember requests will be set `params[:ember_app]` to the name of the application. | ||
In the above example, `params[:ember_app] == :frontend`. | ||
|
||
**Routing options** | ||
|
||
* `to` - The path to handle as an Ember application. This will only apply to | ||
`format: :html` requests. Additionally, this will handle child routes as well. | ||
For instance, mounting `mount_ember_app :frontend, to: "/frontend"` will handle a | ||
`format: :html` request to `/frontend/posts`. | ||
* `controller` - Defaults to `"ember_cli/ember"` | ||
* `action` - Defaults to `"index"` | ||
|
||
Finally, install your Ember application's dependencies: | ||
|
||
```bash | ||
$ rake ember:install | ||
``` | ||
|
||
Boot your Rails application, navigate to `"/"`, and view your EmberCLI | ||
application! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module Jekyll | ||
class RenderMarkdownTag < Liquid::Tag | ||
require "kramdown" | ||
|
||
def initialize(tag_name, text, tokens) | ||
super | ||
@text = text.strip | ||
end | ||
|
||
def render(context) | ||
site = context.registers[:site] | ||
|
||
Kramdown::Document.new(parsed_markdown(site)).to_html | ||
end | ||
|
||
private | ||
|
||
def parsed_markdown(site) | ||
(Liquid::Template.parse markdown_file).render(site.site_payload) | ||
end | ||
|
||
def markdown_file | ||
File.read(File.join(Dir.pwd, "_includes", @text)) | ||
end | ||
end | ||
end | ||
|
||
Liquid::Template.register_tag('render_markdown', Jekyll::RenderMarkdownTag) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.code { | ||
background-color: $code-background-color; | ||
border: solid 1px $code-border-color; | ||
border-radius: $base-border-radius; | ||
font-size: $base-font-size * 1.1; | ||
margin-bottom: 2.5rem; | ||
|
||
@media (min-width: $medium-screen) { | ||
margin-bottom: 4rem; | ||
} | ||
} | ||
|
||
.code__header { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Selector |
||
background-color: $code-header-background-color; | ||
color: darken($code-header-background-color, 40%); | ||
overflow-x: scroll; | ||
padding: 0.75rem 1rem 1rem; | ||
} | ||
|
||
.code__body { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Selector |
||
margin: 0; | ||
overflow-x: scroll; | ||
padding: 0 1rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.