rails-bootstrap-markdown 1.0.0 → 2.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 +1 -0
- data/README.md +4 -1
- data/app/assets/javascripts/bootstrap-markdown-bundle.js +5 -0
- data/app/assets/javascripts/bootstrap-markdown.js +482 -100
- data/app/assets/javascripts/he.js +329 -0
- data/app/assets/javascripts/markdown.js +1477 -1379
- data/app/assets/javascripts/to-markdown.js +10 -5
- data/app/assets/stylesheets/bootstrap-markdown.css.scss +168 -7
- data/lib/rails-bootstrap-markdown/version.rb +1 -1
- metadata +8 -7
@@ -6,6 +6,10 @@
|
|
6
6
|
*
|
7
7
|
*/
|
8
8
|
|
9
|
+
if (typeof he !== 'object' && typeof require === 'function') {
|
10
|
+
var he = require('he');
|
11
|
+
}
|
12
|
+
|
9
13
|
var toMarkdown = function(string) {
|
10
14
|
|
11
15
|
var ELEMENTS = [
|
@@ -58,7 +62,7 @@ var toMarkdown = function(string) {
|
|
58
62
|
{
|
59
63
|
patterns: 'code',
|
60
64
|
replacement: function(str, attrs, innerHTML) {
|
61
|
-
return innerHTML ? '`' + innerHTML + '`' : '';
|
65
|
+
return innerHTML ? '`' + he.decode(innerHTML) + '`' : '';
|
62
66
|
}
|
63
67
|
},
|
64
68
|
{
|
@@ -106,9 +110,10 @@ var toMarkdown = function(string) {
|
|
106
110
|
// Pre code blocks
|
107
111
|
|
108
112
|
string = string.replace(/<pre\b[^>]*>`([\s\S]*)`<\/pre>/gi, function(str, innerHTML) {
|
109
|
-
|
110
|
-
|
111
|
-
|
113
|
+
var text = he.decode(innerHTML);
|
114
|
+
text = text.replace(/^\t+/g, ' '); // convert tabs to spaces (you know it makes sense)
|
115
|
+
text = text.replace(/\n/g, '\n ');
|
116
|
+
return '\n\n ' + text + '\n';
|
112
117
|
});
|
113
118
|
|
114
119
|
// Lists
|
@@ -118,7 +123,7 @@ var toMarkdown = function(string) {
|
|
118
123
|
// Make sure we are escaping the period not matching any character
|
119
124
|
string = string.replace(/^(\s{0,3}\d+)\. /g, '$1\\. ');
|
120
125
|
|
121
|
-
// Converts lists that have no child lists (of same type) first, then works
|
126
|
+
// Converts lists that have no child lists (of same type) first, then works its way up
|
122
127
|
var noChildrenRegex = /<(ul|ol)\b[^>]*>(?:(?!<ul|<ol)[\s\S])*?<\/\1>/gi;
|
123
128
|
while(string.match(noChildrenRegex)) {
|
124
129
|
string = string.replace(noChildrenRegex, function(str) {
|
@@ -1,8 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
* Bootstrap-Markdown.
|
2
|
+
* Bootstrap-Markdown.css.scss
|
3
3
|
*
|
4
4
|
* @author Taufan Aditya @taufanaditya
|
5
|
-
* @
|
5
|
+
* @author Oleg Vivtash <o@vivtash.net> (LESS->SCSS conversion)
|
6
|
+
* @copyright 2013-2014 Taufan Aditya
|
6
7
|
*/
|
7
8
|
|
8
9
|
@import "bootstrap/variables"; // Point this into your bootstrap variables
|
@@ -12,24 +13,30 @@
|
|
12
13
|
$color: $input-border-focus;
|
13
14
|
$color-rgba: rgba(red($color), green($color), blue($color), .6);
|
14
15
|
|
16
|
+
|
15
17
|
.md-editor {
|
16
18
|
display: block;
|
17
19
|
border: 1px solid $table-border-color;
|
18
20
|
|
19
|
-
.md-header, .md-footer {
|
21
|
+
> .md-header, .md-footer {
|
20
22
|
display: block;
|
21
23
|
padding: 6px 4px;
|
22
24
|
background: $panel-default-heading-bg;
|
23
25
|
}
|
24
26
|
|
25
|
-
.md-
|
27
|
+
> .md-header {
|
28
|
+
margin: 0;
|
29
|
+
}
|
30
|
+
|
31
|
+
> .md-preview {
|
26
32
|
background: $panel-bg;
|
27
33
|
border-top: 1px dashed $table-border-color;
|
28
34
|
border-bottom: 1px dashed $table-border-color;
|
29
35
|
min-height: 10px;
|
36
|
+
overflow: auto;
|
30
37
|
}
|
31
38
|
|
32
|
-
textarea {
|
39
|
+
> textarea {
|
33
40
|
font-family: $font-family-monospace;
|
34
41
|
font-size: $font-size-base;
|
35
42
|
outline: 0;
|
@@ -44,17 +51,171 @@ $color-rgba: rgba(red($color), green($color), blue($color), .6);
|
|
44
51
|
border-radius: 0;
|
45
52
|
box-shadow: none;
|
46
53
|
background: $input-bg-disabled;
|
47
|
-
|
48
54
|
&:focus {
|
49
55
|
box-shadow: none;
|
50
56
|
background: $input-bg;
|
51
57
|
}
|
52
58
|
}
|
53
59
|
|
60
|
+
// Hover state
|
61
|
+
$color: $input-border-focus;
|
62
|
+
$color-rgba: rgba(red($color), green($color), blue($color), .6);
|
54
63
|
&.active {
|
55
64
|
border-color: $color;
|
56
65
|
outline: 0;
|
66
|
+
@include box-shadow("inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px ${color-rgba}");
|
67
|
+
}
|
68
|
+
|
69
|
+
.md-controls {
|
70
|
+
float: right;
|
71
|
+
padding: 3px;
|
57
72
|
|
58
|
-
|
73
|
+
.md-control {
|
74
|
+
right: 5px;
|
75
|
+
color: #bebebe;
|
76
|
+
padding: 3px 3px 3px 10px;
|
77
|
+
&:hover {
|
78
|
+
color: #333;
|
79
|
+
}
|
80
|
+
}
|
59
81
|
}
|
82
|
+
|
83
|
+
// fullscreen mode styles
|
84
|
+
&.md-fullscreen-mode {
|
85
|
+
width: 100%;
|
86
|
+
height: 100%;
|
87
|
+
position: fixed;
|
88
|
+
top: 0;
|
89
|
+
left: 0;
|
90
|
+
z-index: 99999;
|
91
|
+
padding: 60px 30px 15px;
|
92
|
+
background: #fff !important;
|
93
|
+
border: 0 !important;
|
94
|
+
|
95
|
+
&.theme-dark {
|
96
|
+
background: #1d1f21 !important;
|
97
|
+
|
98
|
+
.md-fullscreen-controls a {
|
99
|
+
color: #a4b1b1;
|
100
|
+
&:hover {
|
101
|
+
color: #dbe0e0;
|
102
|
+
text-shadow: 0 0 10px #000;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
.md-preview,
|
107
|
+
.md-input,
|
108
|
+
.md-input:hover,
|
109
|
+
.md-input:active,
|
110
|
+
.md-input:focus {
|
111
|
+
color: #dbe0e0;
|
112
|
+
background: #1d1f21 !important;
|
113
|
+
|
114
|
+
}
|
115
|
+
|
116
|
+
.btn {
|
117
|
+
&:hover,
|
118
|
+
&:focus,
|
119
|
+
&.active,
|
120
|
+
&:active {
|
121
|
+
color: #dbe0e0;
|
122
|
+
text-shadow: 0 0 10px #000;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
.md-footer {
|
128
|
+
display: none;
|
129
|
+
}
|
130
|
+
|
131
|
+
.md-input,
|
132
|
+
.md-preview {
|
133
|
+
margin: 0 auto !important;
|
134
|
+
height: 100% !important;
|
135
|
+
font-size: 20px !important;
|
136
|
+
padding: 20px !important;
|
137
|
+
color: #999;
|
138
|
+
line-height: 1.6em !important;
|
139
|
+
resize: none !important;
|
140
|
+
box-shadow: none !important;
|
141
|
+
background: #fff !important;
|
142
|
+
border: 0 !important;
|
143
|
+
}
|
144
|
+
|
145
|
+
.md-preview {
|
146
|
+
color: #333;
|
147
|
+
overflow: auto;
|
148
|
+
}
|
149
|
+
|
150
|
+
.md-input {
|
151
|
+
&:hover,
|
152
|
+
&:focus {
|
153
|
+
color: #333;
|
154
|
+
background: #fff !important;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
.md-header {
|
159
|
+
background: none;
|
160
|
+
text-align: center;
|
161
|
+
position: fixed;
|
162
|
+
width: 100%;
|
163
|
+
top: 20px;
|
164
|
+
}
|
165
|
+
|
166
|
+
.btn-group {
|
167
|
+
float: none;
|
168
|
+
}
|
169
|
+
|
170
|
+
.btn {
|
171
|
+
border: 0;
|
172
|
+
background: none;
|
173
|
+
color: #b3b3b3;
|
174
|
+
|
175
|
+
&:hover,
|
176
|
+
&:focus,
|
177
|
+
&.active,
|
178
|
+
&:active {
|
179
|
+
box-shadow: none;
|
180
|
+
color: #333;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
.md-fullscreen-controls {
|
185
|
+
position: absolute;
|
186
|
+
top: 20px;
|
187
|
+
right: 20px;
|
188
|
+
text-align: right;
|
189
|
+
z-index: 1002;
|
190
|
+
display: block;
|
191
|
+
a {
|
192
|
+
color: #b3b3b3;
|
193
|
+
clear: right;
|
194
|
+
margin: 10px;
|
195
|
+
width: 30px;
|
196
|
+
height: 30px;
|
197
|
+
text-align: center;
|
198
|
+
|
199
|
+
&:hover {
|
200
|
+
color: #333;
|
201
|
+
text-decoration: none;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
.md-editor {
|
207
|
+
height: 100% !important;
|
208
|
+
position: relative;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
.md-fullscreen-controls {
|
213
|
+
display: none;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
.md-nooverflow {
|
218
|
+
overflow: hidden;
|
219
|
+
position: fixed;
|
220
|
+
width: 100%;
|
60
221
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-bootstrap-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Tatom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -17,12 +17,14 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- .gitignore
|
20
|
+
- ".gitignore"
|
21
21
|
- Gemfile
|
22
22
|
- LICENSE.txt
|
23
23
|
- README.md
|
24
24
|
- Rakefile
|
25
|
+
- app/assets/javascripts/bootstrap-markdown-bundle.js
|
25
26
|
- app/assets/javascripts/bootstrap-markdown.js
|
27
|
+
- app/assets/javascripts/he.js
|
26
28
|
- app/assets/javascripts/markdown.js
|
27
29
|
- app/assets/javascripts/to-markdown.js
|
28
30
|
- app/assets/stylesheets/bootstrap-markdown.css.scss
|
@@ -38,19 +40,18 @@ require_paths:
|
|
38
40
|
- lib
|
39
41
|
required_ruby_version: !ruby/object:Gem::Requirement
|
40
42
|
requirements:
|
41
|
-
- -
|
43
|
+
- - ">="
|
42
44
|
- !ruby/object:Gem::Version
|
43
45
|
version: '0'
|
44
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
47
|
requirements:
|
46
|
-
- -
|
48
|
+
- - ">="
|
47
49
|
- !ruby/object:Gem::Version
|
48
50
|
version: '0'
|
49
51
|
requirements: []
|
50
52
|
rubyforge_project:
|
51
|
-
rubygems_version: 2.
|
53
|
+
rubygems_version: 2.2.2
|
52
54
|
signing_key:
|
53
55
|
specification_version: 4
|
54
56
|
summary: A Rails gem for Bootstrap Markdown
|
55
57
|
test_files: []
|
56
|
-
has_rdoc:
|