ZMediumToMarkdown 2.0.5 → 2.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d39b14b2d274522cbd880b0673012c40b749e693d706d8f6906e8df4f19d640
4
- data.tar.gz: 5225ba58b765a96a4894f28cae5cb1394aca8d92dbce5bb7e8bfa74bbe48aa30
3
+ metadata.gz: 15f4bb468ab40811678a1a7b38dc51aa6e442b28a8da0b3835dce158f6d90fd4
4
+ data.tar.gz: 67715feec8e9e7c9f798a61e61529e7846b2db42c86d0c8bd9dd43f3d2de971d
5
5
  SHA512:
6
- metadata.gz: 2ab477a2f0bb769e53eccc479e3839a7963c98ef97a0d46e51d3bf26f04e8cbd555c4f515d5518dba455754a6e29d20044cc87e60e1ae1a9256d286ebdf455db
7
- data.tar.gz: a7ed47c1335ffca2ff33a5a21046c06c5689b6cd4225a4d26854b0ee334eb77aa3c04e5bda8c77d829ad64b55857ccaa14897681859c96a4e6b0dcce1af1b12c
6
+ metadata.gz: 84f8eece59e468fb75768af6ed756dd96812ea81d8c6e6ecaeabf2c090db5f5bea10c39e8fc8693720322681f5ec902966371d4a95476f6f30ac8ada0782702e
7
+ data.tar.gz: 66c66d9b514fd8b0c81776e3dff2a466e91d291ebd9c466de8f6ca8ad19e7ba1d89aa154fa768e746194031805bf8722dbb8f0569b143e2700d04b550c0ce35f
@@ -76,7 +76,7 @@ end
76
76
  begin
77
77
  puts "#https://github.com/ZhgChgLi/ZMediumToMarkdown"
78
78
  puts "You have read and agree with the Disclaimer."
79
- Main.new()
79
+ #Main.new()
80
80
  puts "Execute Successfully!!!"
81
81
  puts "#https://github.com/ZhgChgLi/ZMediumToMarkdown"
82
82
  puts "#Thanks for using this tool."
@@ -86,4 +86,9 @@ rescue => e
86
86
  puts e.backtrace
87
87
  puts "#Please feel free to open an Issue or submit a fix/contribution via Pull Request on:\n"
88
88
  puts "#https://github.com/ZhgChgLi/ZMediumToMarkdown\n"
89
- end
89
+ end
90
+
91
+ obj = JSON.parse('{ "id": "e41429008434_63", "name": "35a0", "type": "ULI", "href": null, "layout": null, "metadata": null, "text": "[New] Customer reviews", "hasDropCap": null, "dropCapImage": null, "markups": [ { "type": "A", "start": 6, "end": 22, "href": "https://developer.apple.com/documentation/appstoreconnectapi/app_store/customer_reviews", "anchorType": "LINK", "userId": null, "linkMetadata": null, "__typename": "Markup" }, { "type": "STRONG", "start": 0, "end": 6, "href": null, "anchorType": null, "userId": null, "linkMetadata": null, "__typename": "Markup" } ], "__typename": "Paragraph", "iframe": null, "mixtapeMetadata": null }')
92
+ p = Paragraph.new(obj, "100")
93
+ r = MarkupParser.new(p, false)
94
+ puts r.parse()
data/lib/Helper.rb CHANGED
@@ -19,6 +19,10 @@ class Helper
19
19
  content
20
20
  end
21
21
 
22
+ def self.escapeMarkdown(text)
23
+ text.gsub(/(\*|_|`|\||\\|\{|\}|\[|\]|\(|\)|#|\+|\-|\.|\!)/){ |x| "\\#{x}" }
24
+ end
25
+
22
26
  def self.escapeHTML(text)
23
27
  if text == "<"
24
28
  "&lt;"
@@ -101,8 +105,8 @@ class Helper
101
105
  result = "---\n"
102
106
  result += "title: #{title}\n"
103
107
  result += "author: #{postInfo.creator}\n"
104
- result += "date: #{postInfo.firstPublishedAt.strftime('%Y-%m-%dT%H:%M:%S.%LZ')}\n"
105
- result += "last_modified_at: #{postInfo.latestPublishedAt.strftime('%Y-%m-%dT%H:%M:%S.%LZ')}\n"
108
+ result += "date: #{postInfo.firstPublishedAt.strftime('%Y-%m-%dT%H:%M:%S.%L%z')}\n"
109
+ result += "last_modified_at: #{postInfo.latestPublishedAt.strftime('%Y-%m-%dT%H:%M:%S.%L%z')}\n"
106
110
  result += "categories: #{postInfo.collectionName}\n"
107
111
  result += "tags: [#{postInfo.tags.join(",")}]\n"
108
112
  result += "description: #{postInfo.description}\n"
@@ -185,9 +189,14 @@ class Helper
185
189
  end
186
190
 
187
191
 
188
- def self.createWatermark(postURL)
192
+ def self.createWatermark(postURL, isForJekyll)
193
+ jekyllOpen = ""
194
+ if isForJekyll
195
+ jekyllOpen = "{:target=\"_blank\"}"
196
+ end
197
+
189
198
  text = "\r\n\r\n\r\n"
190
- text += "_Converted [Medium Post](#{postURL}) by [ZMediumToMarkdown](https://github.com/ZhgChgLi/ZMediumToMarkdown)._"
199
+ text += "_Converted [Medium Post](#{postURL})#{jekyllOpen} by [ZMediumToMarkdown](https://github.com/ZhgChgLi/ZMediumToMarkdown)#{jekyllOpen}._"
191
200
  text += "\r\n"
192
201
 
193
202
  text
@@ -96,14 +96,23 @@ class Paragraph
96
96
  end
97
97
  end
98
98
 
99
- i = 0
100
- while i = orgText.index(/(\*|_|`|\||\\|\{|\}|\[|\]|\(|\)|#|\+|\-|\.|\!)/, i + 1)
101
- escapeMarkup = {
102
- "type" => 'ESCAPE',
103
- "start" => i,
104
- "end" => i + 1
105
- }
106
- markups.append(Markup.new(escapeMarkup))
99
+ index = 0
100
+ orgText.each_char do |char|
101
+
102
+ if char.chars.join() =~ /(\*|_|`|\||\\|\{|\}|\[|\]|\(|\)|#|\+|\-|\.|\!)/
103
+ escapeMarkup = {
104
+ "type" => 'ESCAPE',
105
+ "start" => index,
106
+ "end" => index + 1
107
+ }
108
+ markups.append(Markup.new(escapeMarkup))
109
+ end
110
+
111
+ index += 1
112
+ if char.bytes.length >= 4
113
+ # some emoji need more space (in Medium)
114
+ index += 1
115
+ end
107
116
  end
108
117
 
109
118
  @markups = markups
@@ -16,7 +16,7 @@ class BQParser < Parser
16
16
 
17
17
  def parse(paragraph)
18
18
  if BQParser.isBQ(paragraph)
19
- result = "> #{paragraph.text}"
19
+ result = "> #{paragraph.text} \n\n"
20
20
  result
21
21
  else
22
22
  if !nextParser.nil?
@@ -19,6 +19,12 @@ class IframeParser < Parser
19
19
  end
20
20
 
21
21
  def parse(paragraph)
22
+
23
+ jekyllOpen = ""
24
+ if isForJekyll
25
+ jekyllOpen = "{:target=\"_blank\"}"
26
+ end
27
+
22
28
  if paragraph.type == 'IFRAME'
23
29
 
24
30
  if !paragraph.iframe.src.nil? && paragraph.iframe.src != ""
@@ -27,7 +33,7 @@ class IframeParser < Parser
27
33
  url = "https://medium.com/media/#{paragraph.iframe.id}"
28
34
  end
29
35
 
30
- result = "[#{paragraph.iframe.title}](#{url})"
36
+ result = "[#{paragraph.iframe.title}](#{url})#{jekyllOpen}"
31
37
 
32
38
  if !url[/(www\.youtube\.com)/].nil?
33
39
  # is youtube
@@ -49,12 +55,12 @@ class IframeParser < Parser
49
55
  if ImageDownloader.download(absolutePath, imageURL)
50
56
  relativePath = imagePathPolicy.getRelativePath(fileName)
51
57
  if isForJekyll
52
- result = "\r\n\r\n[![#{title}](/#{relativePath} \"#{title}\")](#{params["url"]})\r\n\r\n"
58
+ result = "\r\n\r\n[![#{title}](/#{relativePath} \"#{title}\")](#{params["url"]})#{jekyllOpen}\r\n\r\n"
53
59
  else
54
- result = "\r\n\r\n[![#{title}](#{relativePath} \"#{title}\")](#{params["url"]})\r\n\r\n"
60
+ result = "\r\n\r\n[![#{title}](#{relativePath} \"#{title}\")](#{params["url"]})#{jekyllOpen}\r\n\r\n"
55
61
  end
56
62
  else
57
- result = "\r\n[#{title}](#{params["url"]})\r\n"
63
+ result = "\r\n[#{title}](#{params["url"]})#{jekyllOpen}\r\n"
58
64
  end
59
65
  end
60
66
  else
@@ -118,9 +124,9 @@ class IframeParser < Parser
118
124
  createdAt = Time.parse(twitterObj["created_at"]).strftime('%Y-%m-%d %H:%M:%S')
119
125
  result = "\n\n"
120
126
  result += "■■■■■■■■■■■■■■ \n"
121
- result += "> **[#{twitterObj["user"]["name"]}](https://twitter.com/#{twitterObj["user"]["screen_name"]}) @ Twitter Says:** \n\n"
127
+ result += "> **[#{twitterObj["user"]["name"]}](https://twitter.com/#{twitterObj["user"]["screen_name"]})#{jekyllOpen} @ Twitter Says:** \n\n"
122
128
  result += "> > #{fullText} \n\n"
123
- result += "> **Tweeted at [#{createdAt}](#{ogURL}).** \n\n"
129
+ result += "> **Tweeted at [#{createdAt}](#{ogURL})#{jekyllOpen}.** \n\n"
124
130
  result += "■■■■■■■■■■■■■■ \n\n"
125
131
  end
126
132
  else
@@ -132,9 +138,9 @@ class IframeParser < Parser
132
138
  end
133
139
 
134
140
  if !ogImageURL.nil?
135
- result = "\r\n\r\n[![#{title}](#{ogImageURL} \"#{title}\")](#{ogURL})\r\n\r\n"
141
+ result = "\r\n\r\n[![#{title}](#{ogImageURL} \"#{title}\")](#{ogURL})#{jekyllOpen}\r\n\r\n"
136
142
  else
137
- result = "[#{title}](#{ogURL})"
143
+ result = "[#{title}](#{ogURL})#{jekyllOpen}"
138
144
  end
139
145
  end
140
146
  end
@@ -5,15 +5,24 @@ require "Parsers/Parser"
5
5
  require 'Models/Paragraph'
6
6
 
7
7
  class MIXTAPEEMBEDParser < Parser
8
- attr_accessor :nextParser
8
+ attr_accessor :nextParser, :isForJekyll
9
+
10
+ def initialize(isForJekyll)
11
+ @isForJekyll = isForJekyll
12
+ end
13
+
9
14
  def parse(paragraph)
10
15
  if paragraph.type == 'MIXTAPE_EMBED'
11
16
  if !paragraph.mixtapeMetadata.nil? && !paragraph.mixtapeMetadata.href.nil?
12
17
  ogImageURL = Helper.fetchOGImage(paragraph.mixtapeMetadata.href)
13
18
  if !ogImageURL.nil?
14
- "\r\n\r\n[![#{paragraph.text}](#{ogImageURL} \"#{paragraph.text}\")](#{paragraph.mixtapeMetadata.href})\r\n\r\n"
19
+ jekyllOpen = ""
20
+ if isForJekyll
21
+ jekyllOpen = "{:target=\"_blank\"}"
22
+ end
23
+ "\r\n\r\n[![](#{ogImageURL})](#{paragraph.mixtapeMetadata.href})#{jekyllOpen}\r\n\r\n"
15
24
  else
16
- "\n[#{paragraph.text}](#{paragraph.mixtapeMetadata.href})"
25
+ "\n#{paragraph.text}"
17
26
  end
18
27
  else
19
28
  "\n#{paragraph.text}"
@@ -7,7 +7,7 @@ require 'securerandom'
7
7
  require 'User'
8
8
 
9
9
  class MarkupParser
10
- attr_accessor :body, :paragraph, :isForJekyll
10
+ attr_accessor :body, :paragraph, :isForJekyll, :usersPostURLs
11
11
 
12
12
  def initialize(paragraph, isForJekyll)
13
13
  @paragraph = paragraph
@@ -18,7 +18,7 @@ class MarkupParser
18
18
  result = paragraph.text
19
19
  if !paragraph.markups.nil? && paragraph.markups.length > 0
20
20
  markupRender = MarkupStyleRender.new(paragraph, isForJekyll)
21
-
21
+ markupRender.usersPostURLs = usersPostURLs
22
22
  begin
23
23
  result = markupRender.parse()
24
24
  rescue => e
@@ -5,7 +5,7 @@ require 'Models/Paragraph'
5
5
  require 'Helper'
6
6
 
7
7
  class MarkupStyleRender
8
- attr_accessor :paragraph, :chars, :encodeType, :isForJekyll
8
+ attr_accessor :paragraph, :chars, :encodeType, :isForJekyll, :usersPostURLs
9
9
 
10
10
  class TextChar
11
11
  attr_accessor :chars, :type
@@ -171,11 +171,11 @@ class MarkupStyleRender
171
171
  if markup.type == "EM"
172
172
  tag = TagChar.new(2, markup.start, markup.end, "_", "_")
173
173
  elsif markup.type == "CODE"
174
- tag = TagChar.new(3, markup.start, markup.end, "`", "`")
174
+ tag = TagChar.new(0, markup.start, markup.end, "`", "`")
175
175
  elsif markup.type == "STRONG"
176
176
  tag = TagChar.new(2, markup.start, markup.end, "**", "**")
177
177
  elsif markup.type == "ESCAPE"
178
- escapeTagChar = TagChar.new(0,markup.start, markup.end,'','')
178
+ escapeTagChar = TagChar.new(999,markup.start, markup.end,'','')
179
179
  escapeTagChar.startChars = TextChar.new('\\'.chars,'Text')
180
180
  escapeTagChar.endChars = TextChar.new([],'Text')
181
181
 
@@ -188,7 +188,27 @@ class MarkupStyleRender
188
188
  url = "https://medium.com/u/#{markup.userId}"
189
189
  end
190
190
 
191
- tag = TagChar.new(1, markup.start, markup.end, "[", "](#{url})")
191
+ lastPath = url.split("/").last
192
+ lastQuery = nil
193
+ if !lastPath.nil?
194
+ lastQuery = lastPath.split("-").last
195
+ end
196
+
197
+ if !usersPostURLs.nil? && !usersPostURLs.find { |usersPostURL| usersPostURL.split("/").last.split("-").last == lastQuery }.nil?
198
+ if isForJekyll
199
+ url = "(../#{lastQuery}/)"
200
+ else
201
+ url = "(#{lastPath})"
202
+ end
203
+ else
204
+ if isForJekyll
205
+ url = "(#{url}){:target=\"_blank\"}"
206
+ else
207
+ url = "(#{url})"
208
+ end
209
+ end
210
+
211
+ tag = TagChar.new(1, markup.start, markup.end, "[", "]#{url}")
192
212
  else
193
213
  Helper.makeWarningText("Undefined Markup Type: #{markup.type}.")
194
214
  end
@@ -205,6 +225,15 @@ class MarkupStyleRender
205
225
 
206
226
  chars.each do |index, char|
207
227
 
228
+ # is in code block
229
+ if !stack.last.nil? && stack.last.endChars.chars.join() == "`"
230
+ containEndTag = tags.select { |tag| tag.endIndex == index && tag.endChars.chars.join() == "`" }.length > 0
231
+ if !containEndTag
232
+ response.append(char)
233
+ next
234
+ end
235
+ end
236
+
208
237
  if char.chars.join() == "\n"
209
238
  brStack = stack.dup
210
239
  while brStack.length > 0
@@ -228,21 +257,16 @@ class MarkupStyleRender
228
257
  end
229
258
 
230
259
  if char.chars.join() != "\n"
231
- if !stack.select { |tag| tag.startChars.chars.join() == "`" }.nil?
232
- # is in code block
233
- response.append(char)
234
- else
235
- resultChar = Helper.escapeMarkdown(char.chars.join())
236
- if isForJekyll
237
- resultChar = Helper.escapeHTML(resultChar)
238
- end
239
-
240
- response.append(TextChar.new(resultChar.chars, "Text"))
260
+ resultChar = char.chars.join()
261
+ if isForJekyll
262
+ resultChar = Helper.escapeHTML(resultChar)
241
263
  end
264
+
265
+ response.append(TextChar.new(resultChar.chars, "Text"))
242
266
  end
243
267
 
244
268
  endTags = tags.select { |tag| tag.endIndex == index }
245
- if !endTags.nil? && endTags.length > 0
269
+ if endTags.length > 0
246
270
  mismatchTags = []
247
271
  while endTags.length > 0
248
272
  stackTag = stack.pop
@@ -268,14 +292,14 @@ class MarkupStyleRender
268
292
  tag = stack.pop
269
293
  response.push(tag.endChars)
270
294
  end
271
-
295
+
272
296
  response = optimize(response)
273
297
  result = response.map{ |response| response.chars }.join()
274
298
 
275
299
  else
276
300
  response = []
277
301
  chars.each do |index, char|
278
- resultChar = escapeMarkdown(char)
302
+ resultChar = char
279
303
  if isForJekyll
280
304
  resultChar = escapeHTML(char)
281
305
  end
@@ -9,7 +9,7 @@ class PQParser < Parser
9
9
  if paragraph.type == 'PQ'
10
10
  result = "\r\n\r\n"
11
11
  paragraph.text.each_line do |p|
12
- result += "> #{p}"
12
+ result += "> #{p} \n\n"
13
13
  end
14
14
  result += "\r\n\r\n"
15
15
 
@@ -19,7 +19,6 @@ require "Parsers/MarkupParser"
19
19
  require "Parsers/OLIParser"
20
20
  require "Parsers/MIXTAPEEMBEDParser"
21
21
  require "Parsers/PQParser"
22
- require "Parsers/LinkParser"
23
22
  require "Parsers/CodeBlockParser"
24
23
 
25
24
  require "PathPolicy"
@@ -30,7 +29,7 @@ require 'date'
30
29
 
31
30
  class ZMediumFetcher
32
31
 
33
- attr_accessor :progress, :linkParser, :isForJekyll
32
+ attr_accessor :progress, :usersPostURLs, :isForJekyll
34
33
 
35
34
  class Progress
36
35
  attr_accessor :username, :postPath, :currentPostIndex, :totalPostsLength, :currentPostParagraphIndex, :totalPostParagraphsLength, :message
@@ -71,7 +70,7 @@ class ZMediumFetcher
71
70
 
72
71
  def initialize
73
72
  @progress = Progress.new()
74
- @linkParser = LinkParser.new()
73
+ @usersPostURLs = nil
75
74
  @isForJekyll = false
76
75
  end
77
76
 
@@ -89,7 +88,7 @@ class ZMediumFetcher
89
88
  ppParser.setNext(uliParser)
90
89
  oliParser = OLIParser.new()
91
90
  uliParser.setNext(oliParser)
92
- mixtapeembedParser = MIXTAPEEMBEDParser.new()
91
+ mixtapeembedParser = MIXTAPEEMBEDParser.new(isForJekyll)
93
92
  oliParser.setNext(mixtapeembedParser)
94
93
  pqParser = PQParser.new()
95
94
  mixtapeembedParser.setNext(pqParser)
@@ -223,8 +222,6 @@ class ZMediumFetcher
223
222
  progress.message = "Converting Post..."
224
223
  progress.printLog()
225
224
 
226
- linkParser.isForJekyll = isForJekyll
227
-
228
225
  postWithDatePath = "#{postInfo.firstPublishedAt.strftime("%Y-%m-%d")}-#{postPath}"
229
226
 
230
227
  absolutePath = postPathPolicy.getAbsolutePath("#{postWithDatePath}.md")
@@ -236,7 +233,7 @@ class ZMediumFetcher
236
233
  if lines.first.start_with?("---")
237
234
  dateLine = lines.select { |line| line.start_with?("last_modified_at:") }.first
238
235
  if !dateLine.nil?
239
- fileLatestPublishedAt = Time.parse(dateLine[/^(last_modified_at:)\s+(\S*)/, 2]).to_i
236
+ #fileLatestPublishedAt = Time.parse(dateLine[/^(last_modified_at:)\s+(\S*)/, 2]).to_i
240
237
  end
241
238
  end
242
239
  end
@@ -260,12 +257,12 @@ class ZMediumFetcher
260
257
 
261
258
  if !(CodeBlockParser.isCodeBlock(paragraph) || PREParser.isPRE(paragraph))
262
259
  markupParser = MarkupParser.new(paragraph, isForJekyll)
260
+ markupParser.usersPostURLs = usersPostURLs
263
261
  paragraph.text = markupParser.parse()
264
262
  end
265
263
 
266
264
  result = startParser.parse(paragraph)
267
- result = linkParser.parse(result)
268
-
265
+
269
266
  file.puts(result)
270
267
 
271
268
  index += 1
@@ -274,7 +271,7 @@ class ZMediumFetcher
274
271
  progress.printLog()
275
272
  end
276
273
 
277
- postWatermark = Helper.createWatermark(postURL)
274
+ postWatermark = Helper.createWatermark(postURL, isForJekyll)
278
275
  if !postWatermark.nil?
279
276
  file.puts(postWatermark)
280
277
  end
@@ -311,7 +308,7 @@ class ZMediumFetcher
311
308
  nextID = postPageInfo["nextID"]
312
309
  end while !nextID.nil?
313
310
 
314
- linkParser.usersPostURLs = postURLS
311
+ @usersPostURLs = postURLS
315
312
 
316
313
  progress.totalPostsLength = postURLS.length
317
314
  progress.currentPostIndex = 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ZMediumToMarkdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZhgChgLi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-20 00:00:00.000000000 Z
11
+ date: 2022-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -74,7 +74,6 @@ files:
74
74
  - lib/Parsers/H4Parser.rb
75
75
  - lib/Parsers/IMGParser.rb
76
76
  - lib/Parsers/IframeParser.rb
77
- - lib/Parsers/LinkParser.rb
78
77
  - lib/Parsers/MIXTAPEEMBEDParser.rb
79
78
  - lib/Parsers/MarkupParser.rb
80
79
  - lib/Parsers/MarkupStyleRender.rb
@@ -1,54 +0,0 @@
1
- $lib = File.expand_path('../', File.dirname(__FILE__))
2
-
3
- require 'Models/Paragraph'
4
-
5
- class LinkParser
6
- attr_accessor :usersPostURLs, :isForJekyll
7
-
8
- def initialize()
9
- @usersPostURLs = []
10
- @isForJekyll = false
11
- end
12
-
13
- def parse(markdownString)
14
- matchLinks = markdownString.scan(/\[[^\]]*\]\(([^\)]+)\)/m)
15
- if !matchLinks.nil?
16
-
17
- matchLinks.each do |matchLink|
18
- link = matchLink[0]
19
- linkMarkdown = "(#{link})"
20
- newLinkMarkdown = linkMarkdown
21
-
22
- if isForJekyll
23
- newLinkMarkdown = "(#{link}){:target=\"_blank\"}"
24
- end
25
-
26
-
27
- if !usersPostURLs.nil?
28
- # if have provide user's post urls
29
- # find & replace medium url to local post url if matched
30
-
31
- if isForJekyll
32
- postPath = link.split("/").last.split("-").last
33
- else
34
- postPath = link.split("/").last
35
- end
36
-
37
- if !usersPostURLs.find { |usersPostURL| usersPostURL.split("/").last.split("-").last == postPath.split("-").last }.nil?
38
- if isForJekyll
39
- newLinkMarkdown = "(../#{postPath}/)"
40
- else
41
- newLinkMarkdown = "(#{postPath})"
42
- end
43
- end
44
- end
45
-
46
- if linkMarkdown != newLinkMarkdown
47
- markdownString = markdownString.sub! linkMarkdown, newLinkMarkdown
48
- end
49
- end
50
- end
51
-
52
- markdownString
53
- end
54
- end