Skip to content
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

Supporting jekyll 4. #8

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,21 @@ Thus plugin does not change how the code is rendered, it only inserts the link b
Styling and positioning the button is up to you. No CSS is provided with this plugin. The CSS used in my example screenshot is:

```css
div.highlight a.playground {
position: absolute;
z-index: 10;
float: right;
right: 8px;
top: 8px;
.highlight div.playground {
text-align: right;
outline: none;
padding: 6px;
}

.highlight a.playground-btn {
border: 1px solid #555;
padding-left: 8px;
padding-right: 8px;
padding-top: 2px;
padding-bottom: 2px;
background-color: #eee;
color:#555;

}
```

Expand Down
4 changes: 2 additions & 2 deletions lib/rust_playground_highlight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class RustPlaygroundHighlight < HighlightBlock
attr_accessor :raw, :gist_id

def add_code_tag(code)
super.sub(/\n*<\/pre>/,"</pre><a href='#{playground_url}' target='_new' class='playground btn btn-xs btn-primary active' role='button'>Run</a>").strip
super.sub(/\n*<\/pre>/,"</pre><div class='playground'><a href='#{playground_url}' target='_new' class='playground-btn' role='button'>Run in Rust Playground</a></div>").strip
end

def render(context)
Expand Down Expand Up @@ -37,7 +37,7 @@ def self.build(rust_highlight_block)
end

def url
"https://play.rust-lang.org/?#{query_string}"
"https://play.rust-lang.org/?#{query_string}&edition=2018"
end
end

Expand Down
4 changes: 2 additions & 2 deletions rust_playground_highlight.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |gem|
gem.name = "rust_playground_highlight"
gem.version = '0.1.3'
gem.version = '0.1.4'
gem.authors = ["IanWhitney"]
gem.email = "ian@ianwhitney.com"
gem.description = %q{Automatically add links to the Rust Playground for code samples in your Jekyll site.}
Expand All @@ -17,5 +17,5 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.license = "MIT"

gem.add_dependency "jekyll", ">= 2.0", "< 4.0"
gem.add_dependency "jekyll", ">= 3.0", "<= 4.2"
end