qiita-markdown 0.44.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +2 -2
- data/.rubocop.yml +0 -4
- data/.rubocop_todo.yml +15 -239
- data/CHANGELOG.md +15 -0
- data/README.md +5 -3
- data/lib/qiita/markdown/filters/checkbox.rb +5 -1
- data/lib/qiita/markdown/filters/code_block.rb +13 -13
- data/lib/qiita/markdown/filters/custom_block.rb +8 -6
- data/lib/qiita/markdown/filters/external_link.rb +2 -0
- data/lib/qiita/markdown/filters/final_sanitizer.rb +126 -120
- data/lib/qiita/markdown/filters/footnote.rb +2 -0
- data/lib/qiita/markdown/filters/group_mention.rb +2 -2
- data/lib/qiita/markdown/filters/heading_anchor.rb +44 -0
- data/lib/qiita/markdown/filters/html_toc.rb +67 -0
- data/lib/qiita/markdown/filters/image_link.rb +6 -6
- data/lib/qiita/markdown/filters/inline_code_color.rb +8 -8
- data/lib/qiita/markdown/filters/mention.rb +11 -9
- data/lib/qiita/markdown/filters/qiita_marker.rb +55 -0
- data/lib/qiita/markdown/filters/simplify.rb +1 -0
- data/lib/qiita/markdown/filters/syntax_highlight.rb +4 -4
- data/lib/qiita/markdown/filters/truncate.rb +1 -3
- data/lib/qiita/markdown/filters/user_input_sanitizer.rb +34 -29
- data/lib/qiita/markdown/processor.rb +2 -1
- data/lib/qiita/markdown/summary_processor.rb +1 -1
- data/lib/qiita/markdown/transformers/filter_attributes.rb +1 -0
- data/lib/qiita/markdown/transformers/filter_iframe.rb +1 -2
- data/lib/qiita/markdown/transformers/filter_script.rb +1 -1
- data/lib/qiita/markdown/transformers/strip_invalid_node.rb +1 -3
- data/lib/qiita/markdown/version.rb +1 -1
- data/lib/qiita/markdown.rb +4 -5
- data/qiita-markdown.gemspec +7 -8
- data/spec/qiita/markdown/filters/checkbox_spec.rb +28 -0
- data/spec/qiita/markdown/filters/heading_anchor_spec.rb +73 -0
- data/spec/qiita/markdown/filters/html_toc_spec.rb +223 -0
- data/spec/qiita/markdown/filters/qiita_marker_spec.rb +60 -0
- data/spec/qiita/markdown/processor_spec.rb +64 -70
- data/spec/qiita/markdown/summary_processor_spec.rb +4 -4
- metadata +80 -102
- data/benchmark/heading_anchor_rendering.rb +0 -248
- data/benchmark/sample.md +0 -317
- data/lib/qiita/markdown/filters/greenmat.rb +0 -38
- data/lib/qiita/markdown/greenmat/heading_rendering.rb +0 -61
- data/lib/qiita/markdown/greenmat/html_renderer.rb +0 -60
- data/lib/qiita/markdown/greenmat/html_toc_renderer.rb +0 -78
- data/spec/qiita/markdown/filters/greenmat_spec.rb +0 -15
- data/spec/qiita/markdown/greenmat/html_toc_renderer_spec.rb +0 -156
@@ -69,16 +69,12 @@ describe Qiita::Markdown::Processor do
|
|
69
69
|
|
70
70
|
it "adds ID for ToC" do
|
71
71
|
should eq <<-HTML.strip_heredoc
|
72
|
-
|
73
72
|
<h1>
|
74
73
|
<span id="a" class="fragment"></span><a href="#a"><i class="fa fa-link"></i></a>a</h1>
|
75
|
-
|
76
74
|
<h2>
|
77
75
|
<span id="a-1" class="fragment"></span><a href="#a-1"><i class="fa fa-link"></i></a>a</h2>
|
78
|
-
|
79
76
|
<h3>
|
80
77
|
<span id="a-2" class="fragment"></span><a href="#a-2"><i class="fa fa-link"></i></a>a</h3>
|
81
|
-
|
82
78
|
<h3>
|
83
79
|
<span id="a-3" class="fragment"></span><a href="#a-3"><i class="fa fa-link"></i></a>a</h3>
|
84
80
|
HTML
|
@@ -94,7 +90,6 @@ describe Qiita::Markdown::Processor do
|
|
94
90
|
|
95
91
|
it "generates fragment identifier by sanitizing the special characters in the title" do
|
96
92
|
should eq <<-HTML.strip_heredoc
|
97
|
-
|
98
93
|
<h1>
|
99
94
|
<span id="rb" class="fragment"></span><a href="#rb"><i class="fa fa-link"></i></a><b>R&B</b>
|
100
95
|
</h1>
|
@@ -109,9 +104,10 @@ describe Qiita::Markdown::Processor do
|
|
109
104
|
MARKDOWN
|
110
105
|
end
|
111
106
|
|
112
|
-
it "
|
107
|
+
it "adds ID for ToC" do
|
113
108
|
should eq <<-HTML.strip_heredoc
|
114
|
-
<h1>
|
109
|
+
<h1>
|
110
|
+
<span id="foo" class="fragment"></span><a href="#foo"><i class="fa fa-link"></i></a>foo</h1>
|
115
111
|
HTML
|
116
112
|
end
|
117
113
|
end
|
@@ -250,7 +246,7 @@ describe Qiita::Markdown::Processor do
|
|
250
246
|
foo
|
251
247
|
|
252
248
|
</code></pre></div></div>
|
253
|
-
|
249
|
+
HTML
|
254
250
|
end
|
255
251
|
end
|
256
252
|
|
@@ -383,7 +379,7 @@ describe Qiita::Markdown::Processor do
|
|
383
379
|
|
384
380
|
context "with @all and allowed_usernames context" do
|
385
381
|
before do
|
386
|
-
context[:allowed_usernames] = [
|
382
|
+
context[:allowed_usernames] = %w[alice bob]
|
387
383
|
end
|
388
384
|
|
389
385
|
let(:markdown) do
|
@@ -400,7 +396,7 @@ describe Qiita::Markdown::Processor do
|
|
400
396
|
|
401
397
|
context "with @all and @alice" do
|
402
398
|
before do
|
403
|
-
context[:allowed_usernames] = [
|
399
|
+
context[:allowed_usernames] = %w[alice bob]
|
404
400
|
end
|
405
401
|
|
406
402
|
let(:markdown) do
|
@@ -517,7 +513,7 @@ describe Qiita::Markdown::Processor do
|
|
517
513
|
it "creates link for that with .autolink class" do
|
518
514
|
should eq(
|
519
515
|
'<p><a href="http://example.com/search?q=%E6%97%A5%E6%9C%AC%E8%AA%9E" class="autolink">' \
|
520
|
-
"http://example.com/search?q=日本語</a></p>\n"
|
516
|
+
"http://example.com/search?q=日本語</a></p>\n",
|
521
517
|
)
|
522
518
|
end
|
523
519
|
end
|
@@ -586,8 +582,8 @@ describe Qiita::Markdown::Processor do
|
|
586
582
|
end
|
587
583
|
|
588
584
|
it "wraps it in a element while keeping the width attribute" do
|
589
|
-
should eq %(<
|
590
|
-
%(<img width="80" height="48" alt="a" src="http://example.com/b.png"></a
|
585
|
+
should eq %(<a href="http://example.com/b.png" target="_blank">) +
|
586
|
+
%(<img width="80" height="48" alt="a" src="http://example.com/b.png"></a>\n)
|
591
587
|
end
|
592
588
|
end
|
593
589
|
|
@@ -613,7 +609,7 @@ describe Qiita::Markdown::Processor do
|
|
613
609
|
|
614
610
|
context "with font element with color attribute" do
|
615
611
|
let(:markdown) do
|
616
|
-
%
|
612
|
+
%(<font color="red">test</font>)
|
617
613
|
end
|
618
614
|
|
619
615
|
it "allows font element with color attribute" do
|
@@ -647,7 +643,7 @@ describe Qiita::Markdown::Processor do
|
|
647
643
|
let(:markdown) do
|
648
644
|
<<-MARKDOWN.strip_heredoc
|
649
645
|
- [ ] a
|
650
|
-
|
646
|
+
- [ ] b
|
651
647
|
MARKDOWN
|
652
648
|
end
|
653
649
|
|
@@ -656,7 +652,6 @@ describe Qiita::Markdown::Processor do
|
|
656
652
|
<ul>
|
657
653
|
<li class="task-list-item">
|
658
654
|
<input type="checkbox" class="task-list-item-checkbox" disabled>a
|
659
|
-
|
660
655
|
<ul>
|
661
656
|
<li class="task-list-item">
|
662
657
|
<input type="checkbox" class="task-list-item-checkbox" disabled>b</li>
|
@@ -698,8 +693,12 @@ describe Qiita::Markdown::Processor do
|
|
698
693
|
it "inserts checkbox" do
|
699
694
|
should eq <<-HTML.strip_heredoc
|
700
695
|
<ul>
|
701
|
-
<li class="task-list-item"
|
702
|
-
<
|
696
|
+
<li class="task-list-item">
|
697
|
+
<p><input type="checkbox" class="task-list-item-checkbox" disabled>a</p>
|
698
|
+
</li>
|
699
|
+
<li class="task-list-item">
|
700
|
+
<p><input type="checkbox" class="task-list-item-checkbox" checked disabled>b</p>
|
701
|
+
</li>
|
703
702
|
</ul>
|
704
703
|
HTML
|
705
704
|
end
|
@@ -759,20 +758,7 @@ describe Qiita::Markdown::Processor do
|
|
759
758
|
end
|
760
759
|
|
761
760
|
it "generates footnotes elements" do
|
762
|
-
should
|
763
|
-
<p><sup id="fnref1"><a href="#fn1" title="test">1</a></sup></p>
|
764
|
-
|
765
|
-
<div class="footnotes">
|
766
|
-
<hr>
|
767
|
-
<ol>
|
768
|
-
|
769
|
-
<li id="fn1">
|
770
|
-
<p>test <a href="#fnref1">↩</a></p>
|
771
|
-
</li>
|
772
|
-
|
773
|
-
</ol>
|
774
|
-
</div>
|
775
|
-
HTML
|
761
|
+
should include('class="footnotes"')
|
776
762
|
end
|
777
763
|
end
|
778
764
|
|
@@ -837,14 +823,15 @@ describe Qiita::Markdown::Processor do
|
|
837
823
|
|
838
824
|
it "does not generate footnote elements" do
|
839
825
|
should eq <<-HTML.strip_heredoc
|
840
|
-
<p
|
826
|
+
<p>[^1]<br>
|
827
|
+
[^1]: test</p>
|
841
828
|
HTML
|
842
829
|
end
|
843
830
|
end
|
844
831
|
|
845
832
|
context "with emoji_names and emoji_url_generator context" do
|
846
833
|
before do
|
847
|
-
context[:emoji_names] = %w
|
834
|
+
context[:emoji_names] = %w[foo o]
|
848
835
|
|
849
836
|
context[:emoji_url_generator] = proc do |emoji_name|
|
850
837
|
"https://example.com/foo.png" if emoji_name == "foo"
|
@@ -860,11 +847,11 @@ describe Qiita::Markdown::Processor do
|
|
860
847
|
it "replaces only the specified emoji names with img elements with custom URL" do
|
861
848
|
should include(
|
862
849
|
'<img class="emoji" title=":foo:" alt=":foo:" src="https://example.com/foo.png"',
|
863
|
-
'<img class="emoji" title=":o:" alt=":o:" src="/images/emoji/unicode/2b55.png"'
|
850
|
+
'<img class="emoji" title=":o:" alt=":o:" src="/images/emoji/unicode/2b55.png"',
|
864
851
|
)
|
865
852
|
|
866
853
|
should_not include(
|
867
|
-
'<img class="emoji" title=":x:" alt=":x:"'
|
854
|
+
'<img class="emoji" title=":x:" alt=":x:"',
|
868
855
|
)
|
869
856
|
end
|
870
857
|
end
|
@@ -881,7 +868,7 @@ describe Qiita::Markdown::Processor do
|
|
881
868
|
it "creates link which does not have rel='nofollow noopener' and target='_blank'" do
|
882
869
|
should eq(
|
883
870
|
'<p><a href="http://qiita.com/?a=b" class="autolink">' \
|
884
|
-
"http://qiita.com/?a=b</a></p>\n"
|
871
|
+
"http://qiita.com/?a=b</a></p>\n",
|
885
872
|
)
|
886
873
|
end
|
887
874
|
end
|
@@ -898,7 +885,7 @@ describe Qiita::Markdown::Processor do
|
|
898
885
|
it "creates link which has rel='nofollow noopener' and target='_blank'" do
|
899
886
|
should eq(
|
900
887
|
'<p><a href="http://external.com/?a=b" class="autolink" rel="nofollow noopener" target="_blank">' \
|
901
|
-
"http://external.com/?a=b</a></p>\n"
|
888
|
+
"http://external.com/?a=b</a></p>\n",
|
902
889
|
)
|
903
890
|
end
|
904
891
|
end
|
@@ -914,7 +901,7 @@ describe Qiita::Markdown::Processor do
|
|
914
901
|
|
915
902
|
it "creates link which does not have rel='nofollow noopener' and target='_blank'" do
|
916
903
|
should eq(
|
917
|
-
"<p><a href=\"http://qiita.com/?a=b\">foobar</a></p>\n"
|
904
|
+
"<p><a href=\"http://qiita.com/?a=b\">foobar</a></p>\n",
|
918
905
|
)
|
919
906
|
end
|
920
907
|
end
|
@@ -930,7 +917,7 @@ describe Qiita::Markdown::Processor do
|
|
930
917
|
|
931
918
|
it "creates link which has rel='nofollow noopener' and target='_blank'" do
|
932
919
|
should eq(
|
933
|
-
"<p><a href=\"http://external.com/?a=b\" rel=\"nofollow noopener\" target=\"_blank\">foobar</a></p>\n"
|
920
|
+
"<p><a href=\"http://external.com/?a=b\" rel=\"nofollow noopener\" target=\"_blank\">foobar</a></p>\n",
|
934
921
|
)
|
935
922
|
end
|
936
923
|
end
|
@@ -947,7 +934,7 @@ describe Qiita::Markdown::Processor do
|
|
947
934
|
it "creates link which has rel='nofollow noopener' and target='_blank'" do
|
948
935
|
should eq(
|
949
936
|
'<p><a href="http://qqqqqqiita.com/?a=b" class="autolink" rel="nofollow noopener" target="_blank">' \
|
950
|
-
"http://qqqqqqiita.com/?a=b</a></p>\n"
|
937
|
+
"http://qqqqqqiita.com/?a=b</a></p>\n",
|
951
938
|
)
|
952
939
|
end
|
953
940
|
end
|
@@ -963,7 +950,7 @@ describe Qiita::Markdown::Processor do
|
|
963
950
|
|
964
951
|
it "creates link which has rel='nofollow noopener' and target='_blank'" do
|
965
952
|
should eq(
|
966
|
-
"<p><a href=\"http://qqqqqqiita.com/?a=b\" rel=\"nofollow noopener\" target=\"_blank\">foobar</a></p>\n"
|
953
|
+
"<p><a href=\"http://qqqqqqiita.com/?a=b\" rel=\"nofollow noopener\" target=\"_blank\">foobar</a></p>\n",
|
967
954
|
)
|
968
955
|
end
|
969
956
|
end
|
@@ -980,7 +967,7 @@ describe Qiita::Markdown::Processor do
|
|
980
967
|
it "creates link which has rel='nofollow noopener' and target='_blank'" do
|
981
968
|
should eq(
|
982
969
|
'<p><a href="http://sub.qiita.com/?a=b" class="autolink" rel="nofollow noopener" target="_blank">' \
|
983
|
-
"http://sub.qiita.com/?a=b</a></p>\n"
|
970
|
+
"http://sub.qiita.com/?a=b</a></p>\n",
|
984
971
|
)
|
985
972
|
end
|
986
973
|
end
|
@@ -996,7 +983,7 @@ describe Qiita::Markdown::Processor do
|
|
996
983
|
|
997
984
|
it "creates link which has rel='nofollow noopener' and target='_blank', and rel value is overwritten" do
|
998
985
|
should eq(
|
999
|
-
"<p><a href=\"http://external.com/?a=b\" rel=\"nofollow noopener\" target=\"_blank\">foobar</a></p>\n"
|
986
|
+
"<p><a href=\"http://external.com/?a=b\" rel=\"nofollow noopener\" target=\"_blank\">foobar</a></p>\n",
|
1000
987
|
)
|
1001
988
|
end
|
1002
989
|
end
|
@@ -1085,13 +1072,10 @@ describe Qiita::Markdown::Processor do
|
|
1085
1072
|
|
1086
1073
|
it "returns HTML output parsed as markdown" do
|
1087
1074
|
expect(subject).to eq <<-HTML.strip_heredoc
|
1088
|
-
<
|
1089
|
-
|
1075
|
+
<details><summary>Folding sample</summary><div>
|
1090
1076
|
<div class="code-frame" data-lang="rb"><div class="highlight"><pre class="codehilite"><code><span class="nb">puts</span> <span class="s2">"Hello, World"</span>
|
1091
1077
|
</code></pre></div></div>
|
1092
|
-
|
1093
|
-
<p></p>
|
1094
|
-
</div></details></p>
|
1078
|
+
</div></details>
|
1095
1079
|
HTML
|
1096
1080
|
end
|
1097
1081
|
end
|
@@ -1425,14 +1409,14 @@ describe Qiita::Markdown::Processor do
|
|
1425
1409
|
if allowed
|
1426
1410
|
it "does not sanitize embed code" do
|
1427
1411
|
should eq <<-HTML.strip_heredoc
|
1428
|
-
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p
|
1412
|
+
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p>
|
1429
1413
|
<script src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
|
1430
1414
|
HTML
|
1431
1415
|
end
|
1432
1416
|
else
|
1433
1417
|
it "forces async attribute on script" do
|
1434
1418
|
should eq <<-HTML.strip_heredoc
|
1435
|
-
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p
|
1419
|
+
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p>
|
1436
1420
|
<script src="https://production-assets.codepen.io/assets/embed/ei.js" async="async"></script>
|
1437
1421
|
HTML
|
1438
1422
|
end
|
@@ -1450,14 +1434,14 @@ describe Qiita::Markdown::Processor do
|
|
1450
1434
|
if allowed
|
1451
1435
|
it "does not sanitize embed code" do
|
1452
1436
|
should eq <<-HTML.strip_heredoc
|
1453
|
-
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p
|
1437
|
+
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p>
|
1454
1438
|
<script src="https://static.codepen.io/assets/embed/ei.js"></script>
|
1455
1439
|
HTML
|
1456
1440
|
end
|
1457
1441
|
else
|
1458
1442
|
it "forces async attribute on script" do
|
1459
1443
|
should eq <<-HTML.strip_heredoc
|
1460
|
-
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p
|
1444
|
+
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p>
|
1461
1445
|
<script src="https://static.codepen.io/assets/embed/ei.js" async="async"></script>
|
1462
1446
|
HTML
|
1463
1447
|
end
|
@@ -1747,7 +1731,7 @@ describe Qiita::Markdown::Processor do
|
|
1747
1731
|
|
1748
1732
|
it "does not sanitize embed code" do
|
1749
1733
|
should eq <<-HTML.strip_heredoc
|
1750
|
-
<blockquote class="twitter-tweet" data-lang="es" data-cards="hidden" data-conversation="none">foo</blockquote
|
1734
|
+
<blockquote class="twitter-tweet" data-lang="es" data-cards="hidden" data-conversation="none">foo</blockquote>
|
1751
1735
|
<script async src="https://platform.twitter.com/widgets.js"></script>
|
1752
1736
|
HTML
|
1753
1737
|
end
|
@@ -1809,14 +1793,16 @@ describe Qiita::Markdown::Processor do
|
|
1809
1793
|
if allowed
|
1810
1794
|
it "returns simple div element" do
|
1811
1795
|
should eq <<-HTML.strip_heredoc
|
1812
|
-
<div data-type="customblock">
|
1796
|
+
<div data-type="customblock" data-metadata="">
|
1797
|
+
<p>Some kind of text is here.</p>
|
1813
1798
|
</div>
|
1814
1799
|
HTML
|
1815
1800
|
end
|
1816
1801
|
else
|
1817
1802
|
it "returns simple div element" do
|
1818
1803
|
should eq <<-HTML.strip_heredoc
|
1819
|
-
<div>
|
1804
|
+
<div>
|
1805
|
+
<p>Some kind of text is here.</p>
|
1820
1806
|
</div>
|
1821
1807
|
HTML
|
1822
1808
|
end
|
@@ -1829,14 +1815,16 @@ describe Qiita::Markdown::Processor do
|
|
1829
1815
|
if allowed
|
1830
1816
|
it "returns simple div element" do
|
1831
1817
|
should eq <<-HTML.strip_heredoc
|
1832
|
-
<div data-type="customblock" data-metadata="anytype">
|
1818
|
+
<div data-type="customblock" data-metadata="anytype">
|
1819
|
+
<p>Some kind of text is here.</p>
|
1833
1820
|
</div>
|
1834
1821
|
HTML
|
1835
1822
|
end
|
1836
1823
|
else
|
1837
1824
|
it "returns simple div element" do
|
1838
1825
|
should eq <<-HTML.strip_heredoc
|
1839
|
-
<div>
|
1826
|
+
<div>
|
1827
|
+
<p>Some kind of text is here.</p>
|
1840
1828
|
</div>
|
1841
1829
|
HTML
|
1842
1830
|
end
|
@@ -1851,8 +1839,9 @@ describe Qiita::Markdown::Processor do
|
|
1851
1839
|
it "returns info note block with class including icon as default type" do
|
1852
1840
|
should eq <<-HTML.strip_heredoc
|
1853
1841
|
<div data-type="customblock" data-metadata="note" class="note info">
|
1854
|
-
<span class="fa fa-fw fa-check-circle"></span><
|
1855
|
-
|
1842
|
+
<span class="fa fa-fw fa-check-circle"></span><div>
|
1843
|
+
<p>Some kind of text is here.</p>
|
1844
|
+
</div>
|
1856
1845
|
</div>
|
1857
1846
|
HTML
|
1858
1847
|
end
|
@@ -1860,8 +1849,9 @@ describe Qiita::Markdown::Processor do
|
|
1860
1849
|
it "returns note block with class including icon" do
|
1861
1850
|
should eq <<-HTML.strip_heredoc
|
1862
1851
|
<div class="note info">
|
1863
|
-
<span class="fa fa-fw fa-check-circle"></span><
|
1864
|
-
|
1852
|
+
<span class="fa fa-fw fa-check-circle"></span><div>
|
1853
|
+
<p>Some kind of text is here.</p>
|
1854
|
+
</div>
|
1865
1855
|
</div>
|
1866
1856
|
HTML
|
1867
1857
|
end
|
@@ -1875,8 +1865,9 @@ describe Qiita::Markdown::Processor do
|
|
1875
1865
|
it "returns warning note block with class including icon" do
|
1876
1866
|
should eq <<-HTML.strip_heredoc
|
1877
1867
|
<div data-type="customblock" data-metadata="note warn" class="note warn">
|
1878
|
-
<span class="fa fa-fw fa-exclamation-circle"></span><
|
1879
|
-
|
1868
|
+
<span class="fa fa-fw fa-exclamation-circle"></span><div>
|
1869
|
+
<p>Some kind of text is here.</p>
|
1870
|
+
</div>
|
1880
1871
|
</div>
|
1881
1872
|
HTML
|
1882
1873
|
end
|
@@ -1884,8 +1875,9 @@ describe Qiita::Markdown::Processor do
|
|
1884
1875
|
it "returns note block with class including icon" do
|
1885
1876
|
should eq <<-HTML.strip_heredoc
|
1886
1877
|
<div class="note warn">
|
1887
|
-
<span class="fa fa-fw fa-exclamation-circle"></span><
|
1888
|
-
|
1878
|
+
<span class="fa fa-fw fa-exclamation-circle"></span><div>
|
1879
|
+
<p>Some kind of text is here.</p>
|
1880
|
+
</div>
|
1889
1881
|
</div>
|
1890
1882
|
HTML
|
1891
1883
|
end
|
@@ -1899,8 +1891,9 @@ describe Qiita::Markdown::Processor do
|
|
1899
1891
|
it "returns alerting note block with class including icon" do
|
1900
1892
|
should eq <<-HTML.strip_heredoc
|
1901
1893
|
<div data-type="customblock" data-metadata="note alert" class="note alert">
|
1902
|
-
<span class="fa fa-fw fa-times-circle"></span><
|
1903
|
-
|
1894
|
+
<span class="fa fa-fw fa-times-circle"></span><div>
|
1895
|
+
<p>Some kind of text is here.</p>
|
1896
|
+
</div>
|
1904
1897
|
</div>
|
1905
1898
|
HTML
|
1906
1899
|
end
|
@@ -1908,8 +1901,9 @@ describe Qiita::Markdown::Processor do
|
|
1908
1901
|
it "returns note block with class including icon" do
|
1909
1902
|
should eq <<-HTML.strip_heredoc
|
1910
1903
|
<div class="note alert">
|
1911
|
-
<span class="fa fa-fw fa-times-circle"></span><
|
1912
|
-
|
1904
|
+
<span class="fa fa-fw fa-times-circle"></span><div>
|
1905
|
+
<p>Some kind of text is here.</p>
|
1906
|
+
</div>
|
1913
1907
|
</div>
|
1914
1908
|
HTML
|
1915
1909
|
end
|
@@ -11,7 +11,7 @@ describe Qiita::Markdown::SummaryProcessor do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
let(:markdown) do
|
14
|
-
|
14
|
+
raise NotImplementedError
|
15
15
|
end
|
16
16
|
|
17
17
|
let(:result) do
|
@@ -111,7 +111,6 @@ describe Qiita::Markdown::SummaryProcessor do
|
|
111
111
|
it "flattens them" do
|
112
112
|
should eq <<-EOS.strip_heredoc
|
113
113
|
Lorem ipsum dolor sit amet.
|
114
|
-
|
115
114
|
Consectetur adipisicing elit.
|
116
115
|
EOS
|
117
116
|
end
|
@@ -240,7 +239,7 @@ describe Qiita::Markdown::SummaryProcessor do
|
|
240
239
|
end
|
241
240
|
|
242
241
|
it "replaces mention with link" do
|
243
|
-
should eq %
|
242
|
+
should eq %(<a href="/alice" class="user-mention js-hovercard" title="alice" data-hovercard-target-type="user" data-hovercard-target-name="alice">@alice</a>\n)
|
244
243
|
end
|
245
244
|
end
|
246
245
|
|
@@ -254,7 +253,8 @@ describe Qiita::Markdown::SummaryProcessor do
|
|
254
253
|
|
255
254
|
it "does not generate footnote elements by default" do
|
256
255
|
should eq <<-EOS.strip_heredoc
|
257
|
-
|
256
|
+
[^1]
|
257
|
+
[^1]: test
|
258
258
|
EOS
|
259
259
|
end
|
260
260
|
end
|