middleman-syntax 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -1
- data/README.md +7 -11
- data/features/lexer_options.feature +19 -0
- data/features/support/step_definitions.rb +10 -0
- data/lib/middleman-syntax/highlighter.rb +5 -4
- data/lib/middleman-syntax/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30c25881bfd1e91ef4958299d4e09fe9848a4581fe3b22bdaf9aad0ae13e2723
|
4
|
+
data.tar.gz: 8ed74ea53b6e515c01be63330170110d809f87bf48715fe386245c939cac8998
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 390e71b77bb6d00ebbc57b2702ba4731aa00a0778cfa2caa121d80296aa50b978a6a191620f93bcecf5127104128618e65987754d179a65c79a4675013e35717
|
7
|
+
data.tar.gz: df4eb1fec24e35e553d92e346d0b2dad4f368064a4926e3cc0a4a0bcb102eec2a17acfc652ee3151c057db75b76cb410c8452cd159202e340e3e1b8157455acb
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Middleman-Syntax
|
2
2
|
|
3
|
-
`middleman-syntax` is an extension for the [Middleman] static site generator that adds syntax highlighting via [Rouge](https://github.com/jayferd/rouge).
|
3
|
+
`middleman-syntax` is an extension for the [Middleman](https://middlemanapp.com) static site generator that adds syntax highlighting via [Rouge](https://github.com/jayferd/rouge).
|
4
4
|
|
5
|
-
[]
|
5
|
+
[](https://rubygems.org/gems/middleman-syntax)
|
6
6
|
[](https://github.com/middleman/middleman-syntax/actions/workflows/ci.yml)
|
7
|
-
[](https://qlty.sh/gh/middleman/projects/middleman-syntax)
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -59,7 +59,7 @@ end
|
|
59
59
|
<% end %>
|
60
60
|
```
|
61
61
|
|
62
|
-
|
62
|
+
**NOTE:** In Haml, use `=`, not `-`:
|
63
63
|
|
64
64
|
```haml
|
65
65
|
= code('ruby') do
|
@@ -105,6 +105,7 @@ end
|
|
105
105
|
```
|
106
106
|
|
107
107
|
This will produce HTML like:
|
108
|
+
|
108
109
|
```html
|
109
110
|
<div class="highlight"><pre class="highlight ruby custom-class special"><code>...</code></pre></div>
|
110
111
|
```
|
@@ -125,7 +126,7 @@ And then include it in your layout or specific page by:
|
|
125
126
|
<%= stylesheet_link_tag "highlighting" %>
|
126
127
|
```
|
127
128
|
|
128
|
-
If you want to include this in a larger Sass stylesheet, include it in your main stylesheet with `@import 'highlighting.css'
|
129
|
+
If you want to include this in a larger Sass stylesheet, include it in your main stylesheet with `@import 'highlighting.css'`.
|
129
130
|
|
130
131
|
Rouge has `ThankfulEyes`, `Colorful`, `Github`, `Base16`, `Base16::Solarized`, `Base16::Monokai`, and `Monokai` themes.
|
131
132
|
|
@@ -232,9 +233,4 @@ The best way to get quick responses to your issues and swift fixes to your bugs
|
|
232
233
|
|
233
234
|
## License
|
234
235
|
|
235
|
-
Copyright (c) 2012-2014 Benjamin Hollis. MIT Licensed, see [LICENSE] for details.
|
236
|
-
|
237
|
-
[middleman]: http://middlemanapp.com
|
238
|
-
[gem]: https://rubygems.org/gems/middleman-syntax
|
239
|
-
[codeclimate]: https://codeclimate.com/github/middleman/middleman-syntax
|
240
|
-
[LICENSE]: https://github.com/middleman/middleman-syntax/blob/master/LICENSE.md
|
236
|
+
Copyright (c) 2012-2014 Benjamin Hollis. MIT Licensed, see [LICENSE](LICENSE.md) for details.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature: Lexer options configuration
|
2
|
+
|
3
|
+
Scenario: Lexer options are passed to Rouge lexer
|
4
|
+
Given a fixture app "test-app"
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
activate :syntax, :lexer_options => { :prompt => 'myshell>>>' }
|
8
|
+
"""
|
9
|
+
And a file named "source/console_code.html.erb" with:
|
10
|
+
"""
|
11
|
+
<% code("console") do %>
|
12
|
+
myshell>>> echo "hello world"
|
13
|
+
myshell>>> echo "test"
|
14
|
+
<% end %>
|
15
|
+
"""
|
16
|
+
And the Server is running
|
17
|
+
When I go to "/console_code.html"
|
18
|
+
Then I should see '<span class="gp">myshell>>></span>'
|
19
|
+
And I should not see '<span class="o">>></span>'
|
@@ -2,3 +2,13 @@
|
|
2
2
|
Then(/^I should not see line numbers markup$/) do
|
3
3
|
expect(page).not_to have_selector("pre.lineno")
|
4
4
|
end
|
5
|
+
|
6
|
+
# step definition for testing that specific content is not present
|
7
|
+
Then(/^I should not see "([^"]*)"$/) do |content|
|
8
|
+
expect(page.body).not_to include(content)
|
9
|
+
end
|
10
|
+
|
11
|
+
# step definition for testing that specific content is not present (new format)
|
12
|
+
Then('I should not see {string}') do |content|
|
13
|
+
expect(page.body).not_to include(content)
|
14
|
+
end
|
@@ -7,14 +7,15 @@ module Middleman
|
|
7
7
|
|
8
8
|
# A helper module for highlighting code
|
9
9
|
def self.highlight(code, language=nil, opts={})
|
10
|
-
lexer = Rouge::Lexer.find_fancy(language, code) || Rouge::Lexers::PlainText
|
11
|
-
|
12
10
|
highlighter_options = options.to_h.merge(opts)
|
13
|
-
highlighter_options[:css_class] = [ highlighter_options[:css_class], lexer.tag ].join(' ')
|
14
11
|
lexer_options = highlighter_options.delete(:lexer_options)
|
12
|
+
|
13
|
+
lexer = Rouge::Lexer.find_fancy(language, code, lexer_options) || Rouge::Lexers::PlainText
|
14
|
+
|
15
|
+
highlighter_options[:css_class] = [ highlighter_options[:css_class], lexer.tag ].join(' ')
|
15
16
|
|
16
17
|
formatter = Middleman::Syntax::Formatters::HTML.new(highlighter_options)
|
17
|
-
formatter.format(lexer.lex(code
|
18
|
+
formatter.format(lexer.lex(code))
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-syntax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Hollis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- features/extra_css_classes.feature
|
57
57
|
- features/haml_filter.feature
|
58
58
|
- features/helper.feature
|
59
|
+
- features/lexer_options.feature
|
59
60
|
- features/markdown.feature
|
60
61
|
- features/markdown_line_numbers_disabled.feature
|
61
62
|
- features/markdown_line_numbers_enabled.feature
|
@@ -100,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
103
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
104
|
+
rubygems_version: 3.5.16
|
104
105
|
signing_key:
|
105
106
|
specification_version: 4
|
106
107
|
summary: Code syntax highlighting plugin via rouge for Middleman
|
@@ -108,6 +109,7 @@ test_files:
|
|
108
109
|
- features/extra_css_classes.feature
|
109
110
|
- features/haml_filter.feature
|
110
111
|
- features/helper.feature
|
112
|
+
- features/lexer_options.feature
|
111
113
|
- features/markdown.feature
|
112
114
|
- features/markdown_line_numbers_disabled.feature
|
113
115
|
- features/markdown_line_numbers_enabled.feature
|