Skip to content

Commit dd557e1

Browse files
Merge pull request #6 from digitalmoksha/sync-with-11.0
Sync from 10.0.0 to 11.0.0
2 parents 6216398 + d34e406 commit dd557e1

File tree

9 files changed

+55
-20
lines changed

9 files changed

+55
-20
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
11.0.0
2+
-------
3+
4+
Synced with markdown-it 11.0.0, see the [CHANGELOG](https://github.com/markdown-it/markdown-it/blob/master/CHANGELOG.md)
5+
16
10.0.0
27
-------
38

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Ruby/RubyMotion version of Markdown-it (CommonMark compliant and extendable)
77

88
This gem is a port of the [markdown-it Javascript package](https://github.com/markdown-it/markdown-it) by Vitaly Puzrin and Alex Kocharin.
99

10-
_Currently synced with markdown-it 10.0.0_
10+
_Currently synced with markdown-it 11.0.0_
1111

1212
---
1313

@@ -274,6 +274,10 @@ md = require('markdown-it')({
274274
});
275275
```
276276
277+
You can find all rules in sources:
278+
[parser_core.js](lib/parser_core.js), [parser_block](lib/parser_block.js),
279+
[parser_inline](lib/parser_inline.js).
280+
277281
278282
## Benchmark
279283

lib/motion-markdown-it/index.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def set(options)
352352
# MarkdownIt.configure(presets)
353353
#
354354
# Batch load of all options and compenent settings. This is internal method,
355-
# and you probably will not need it. But if you with - see available presets
355+
# and you probably will not need it. But if you will - see available presets
356356
# and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)
357357
#
358358
# We strongly recommend to use presets instead of direct config loads. That
@@ -474,7 +474,7 @@ def use(plugin, *args)
474474
# - src (String): source string
475475
# - env (Object): environment sandbox
476476
#
477-
# Parse input string and returns list of block tokens (special token type
477+
# Parse input string and return list of block tokens (special token type
478478
# "inline" will contain list of inline tokens). You should not call this
479479
# method directly, until you write custom renderer (for example, to produce
480480
# AST).
@@ -542,4 +542,4 @@ def renderInline(src, env = {})
542542
end
543543

544544
end
545-
end
545+
end

lib/motion-markdown-it/rules_core/replacements.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ def self.replace_rare(inlineTokens)
6767
gsub(/\.{2,}/, '…').gsub(/([?!])…/, "\\1..").
6868
gsub(/([?!]){4,}/, '\\1\\1\\1').gsub(/,{2,}/, ',').
6969
# em-dash
70-
gsub(/(^|[^-])---([^-]|$)/m, "\\1\u2014\\2").
70+
gsub(/(^|[^-])---(?=[^-]|$)/m, "\\1\u2014").
7171
# en-dash
72-
gsub(/(^|\s)--(\s|$)/m, "\\1\u2013\\2").
73-
gsub(/(^|[^-\s])--([^-\s]|$)/m, "\\1\u2013\\2")
72+
gsub(/(^|\s)--(?=\s|$)/m, "\\1\u2013").
73+
gsub(/(^|[^-\s])--(?=[^-\s]|$)/m, "\\1\u2013")
7474
end
7575
end
7676

lib/motion-markdown-it/rules_core/smartquotes.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,14 @@ def self.process_inlines(tokens, state)
113113
end
114114

115115
if (canOpen && canClose)
116-
# treat this as the middle of the word
117-
canOpen = false
116+
# Replace quotes in the middle of punctuation sequence, but not
117+
# in the middle of the words, i.e.:
118+
#
119+
# 1. foo " bar " baz - not replaced
120+
# 2. foo-"-bar-"-baz - replaced
121+
# 3. foo"bar"baz - not replaced
122+
#
123+
canOpen = isLastPunctChar
118124
canClose = isNextPunctChar
119125
end
120126

lib/motion-markdown-it/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module MotionMarkdownIt
2-
VERSION = '10.0.0'
2+
VERSION = '11.0.0'
33
end

spec/motion-markdown-it/fixtures/markdown-it/smartquotes.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,10 @@ and “that”.</p>
137137
<p>“this” and<br>
138138
“that”.</p>
139139
.
140+
141+
Should allow quotes adjacent to other punctuation characters, #643:
142+
.
143+
The dog---"'man's' best friend"
144+
.
145+
<p>The dog—“‘man’s’ best friend”</p>
146+
.

spec/motion-markdown-it/fixtures/markdown-it/tables.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,59 +168,59 @@ bar|bar
168168
Second line should not contain symbols except "-", ":", "|" and " ":
169169
.
170170
foo|foo
171-
---|---s
171+
-----|-----s
172172
bar|bar
173173
.
174174
<p>foo|foo
175-
—|---s
175+
-----|-----s
176176
bar|bar</p>
177177
.
178178

179179

180180
Second line should contain "|" symbol:
181181
.
182182
foo|foo
183-
---:---
183+
-----:-----
184184
bar|bar
185185
.
186186
<p>foo|foo
187-
—:---
187+
-----:-----
188188
bar|bar</p>
189189
.
190190

191191

192192
Second line should not have empty columns in the middle:
193193
.
194194
foo|foo
195-
---||---
195+
-----||-----
196196
bar|bar
197197
.
198198
<p>foo|foo
199-
—||—
199+
-----||-----
200200
bar|bar</p>
201201
.
202202

203203

204204
Wrong alignment symbol position:
205205
.
206206
foo|foo
207-
---|-::-
207+
-----|-::-
208208
bar|bar
209209
.
210210
<p>foo|foo
211-
|-::-
211+
-----|-::-
212212
bar|bar</p>
213213
.
214214

215215

216216
Title line should contain "|" symbol:
217217
.
218218
foo
219-
---|---
219+
-----|-----
220220
bar|bar
221221
.
222222
<p>foo
223-
—|---
223+
-----|-----
224224
bar|bar</p>
225225
.
226226

spec/motion-markdown-it/fixtures/markdown-it/typographer.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,16 @@ markdownit--awesome
7979
<p>–markdownit – super–</p>
8080
<p>markdownit–awesome</p>
8181
.
82+
83+
regression tests for #624
84+
.
85+
1---2---3
86+
87+
1--2--3
88+
89+
1 -- -- 3
90+
.
91+
<p>1—2—3</p>
92+
<p>1–2–3</p>
93+
<p>1 – – 3</p>
94+
.

0 commit comments

Comments
 (0)