markdown-analysis 0.1.1__tar.gz → 0.1.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: markdown_analysis
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: UNKNOWN
5
5
  Home-page: https://github.com/yannbanas/mrkdwn_analysis
6
6
  Author: yannbanas
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: markdown-analysis
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: UNKNOWN
5
5
  Home-page: https://github.com/yannbanas/mrkdwn_analysis
6
6
  Author: yannbanas
@@ -284,19 +284,24 @@ class MarkdownParser:
284
284
  self.pos = self.length
285
285
 
286
286
  def parse_fenced_code_block(self, lang):
287
+ initial_line = self.pos
288
+ initial_indent = len(self.lines[self.pos]) - len(self.lines[self.pos].lstrip())
289
+ fence_marker = self.lines[self.pos].strip()[:3] # Get ``` or ~~~
287
290
  self.pos += 1
288
291
  start = self.pos
292
+
289
293
  while self.pos < self.length:
290
294
  line = self.lines[self.pos]
291
- if line.strip().startswith('```'):
295
+ if line.strip() == fence_marker:
292
296
  content = "\n".join(self.lines[start:self.pos])
293
297
  self.tokens.append(BlockToken('code', content=content, meta={"language": lang}, line=start+1))
294
298
  self.pos += 1
295
299
  return
296
300
  self.pos += 1
297
- content = "\n".join(self.lines[start:])
298
- self.tokens.append(BlockToken('code', content=content, meta={"language": lang}, line=start+1))
299
- self.pos = self.length
301
+
302
+ # If we reach here, we didn't find the closing fence
303
+ self.pos = initial_line # Reset position if fence not found
304
+ raise ValueError(f"Unclosed code fence starting at line {initial_line + 1}")
300
305
 
301
306
  def parse_blockquote(self):
302
307
  start = self.pos
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
6
6
 
7
7
  setup(
8
8
  name='markdown_analysis',
9
- version='0.1.1',
9
+ version='0.1.2',
10
10
  long_description=long_description,
11
11
  long_description_content_type="text/markdown",
12
12
  author='yannbanas',