slack-markdown-parser 2.4.1__tar.gz → 2.4.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.
Files changed (18) hide show
  1. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/CHANGELOG.md +7 -0
  2. {slack_markdown_parser-2.4.1/slack_markdown_parser.egg-info → slack_markdown_parser-2.4.2}/PKG-INFO +1 -1
  3. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/docs/spec-ja.md +1 -0
  4. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/docs/spec.md +1 -0
  5. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/pyproject.toml +1 -1
  6. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/slack_markdown_parser/__init__.py +1 -1
  7. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/slack_markdown_parser/converter.py +17 -3
  8. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2/slack_markdown_parser.egg-info}/PKG-INFO +1 -1
  9. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/LICENSE +0 -0
  10. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/MANIFEST.in +0 -0
  11. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/README-ja.md +0 -0
  12. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/README.md +0 -0
  13. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/setup.cfg +0 -0
  14. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/slack_markdown_parser/py.typed +0 -0
  15. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/slack_markdown_parser.egg-info/SOURCES.txt +0 -0
  16. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/slack_markdown_parser.egg-info/dependency_links.txt +0 -0
  17. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/slack_markdown_parser.egg-info/requires.txt +0 -0
  18. {slack_markdown_parser-2.4.1 → slack_markdown_parser-2.4.2}/slack_markdown_parser.egg-info/top_level.txt +0 -0
@@ -6,6 +6,13 @@ The format is based on Keep a Changelog, and the project follows Semantic Versio
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.4.2] - 2026-05-29
10
+
11
+ ### Fixed
12
+
13
+ - Stopped an unbalanced emphasis delimiter from corrupting unrelated, well-formed spans in the same block. The bold/italic/strikethrough patterns are matched with `re.DOTALL`, so a single stray `**` (for example a whitespace-flanked literal `**` in `閉じ ** が`, or an unclosed marker) shifted marker pairing across the whole block and flipped the protective ZWSP of nearby punctuation-terminated bold to the broken *outer* position, re-exposing the literal markers on Slack. `EMPHASIS_PATTERNS` now enforces CommonMark's minimal flanking requirement — an opening run is not followed by whitespace and a closing run is not preceded by whitespace — so a non-flanking stray marker stays literal and no longer disturbs its neighbours.
14
+ - Bounded the `**` and `~~` emphasis bodies to a single delimiter run so a dangling opener with no valid closer of its own (for example `**oops **` or `**: x **` before a later `**…%**`) can no longer scan past the literal stray and steal a following well-formed span's closing marker, which had misplaced that span's protective ZWSP. The single-`*` italic body is intentionally left unbounded because italics legitimately wrap `**bold**`.
15
+
9
16
  ## [2.4.1] - 2026-05-29
10
17
 
11
18
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: slack-markdown-parser
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: Convert LLM Markdown into Slack Block Kit messages
5
5
  Author: darkgaldragon
6
6
  License-Expression: MIT
@@ -178,6 +178,7 @@ LLM は外枠パイプの省略、区切り行の欠落、列数の不一致な
178
178
  - チャンクの先頭・末尾(行頭・行末・テキスト端、またはフェンスドコードブロックの境界)は安全とみなし、ゼロ幅スペースを付けません。
179
179
  - 外側の片方が前後の非境界テキストに密着している場合、その側だけにゼロ幅スペースを付けます。安全(境界)側はそのままにします。
180
180
  - 強調マーカー(`**`・`*`・`~~`)の内側が句読点に密着している場合(例 `**注意:**` や `**70.9%→83.0%**`)、マーカーの内側にゼロ幅スペースを挿入します。これによりマーカーの内側隣接文字が非句読点になり、後続が何であっても Slack の CommonMark right-/left-flanking 判定が成立します。Slack が flanking 近傍として認めない CJK テキストや CJK 句読点(`、` / `。`)の直前でも有効です。インラインコードは flanking 規則の対象外なので、このルールから除外します。
181
+ - 強調デリミタは CommonMark の最小 flanking 条件を満たす場合のみ認識します。すなわち、開きランの直後が空白でなく、閉じランの直前が空白でないこと。両側が空白の単独マーカー(例 `閉じ ** が` の literal な `**`)や、その他の対になっていないマーカーはそのまま残します。これにより、1 個の余分なマーカーが近くの正しい装飾のペアリングをずらして、ゼロ幅スペースを誤った位置に挿入することを防ぎます。
181
182
 
182
183
  例外:
183
184
 
@@ -177,6 +177,7 @@ Rules:
177
177
  - The start and end of a chunk (a line/text boundary, or the edge of a fenced code block) are treated as safe; no zero-width space is added there.
178
178
  - When an outer edge is tight against surrounding non-boundary text, only that edge is padded with a zero-width space. The safe (boundary) edge is left clean.
179
179
  - When an emphasis marker (`**`, `*`, `~~`) sits directly against punctuation on its inner side (for example `**注意:**` or `**70.9%→83.0%**`), a zero-width space is inserted just *inside* the marker. This makes the marker's inner neighbor a non-punctuation character, so Slack's CommonMark right-/left-flanking check succeeds regardless of what surrounds the token — including before CJK text and CJK punctuation (`、` / `。`), which Slack does not accept as a flanking neighbor. Inline code spans are exempt from this rule because they do not obey flanking rules.
180
+ - Emphasis delimiters are recognized only when they satisfy CommonMark's minimal flanking rule: an opening run is not immediately followed by whitespace, and a closing run is not immediately preceded by whitespace. A stray, whitespace-flanked marker (for example the literal `**` in `閉じ ** が`), or an otherwise unbalanced marker, is left untouched. This prevents one dangling marker from shifting the pairing of nearby well-formed spans and misplacing their zero-width spaces.
180
181
 
181
182
  Exception:
182
183
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "slack-markdown-parser"
7
- version = "2.4.1"
7
+ version = "2.4.2"
8
8
  description = "Convert LLM Markdown into Slack Block Kit messages"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,6 +1,6 @@
1
1
  """slack-markdown-parser public package API."""
2
2
 
3
- __version__ = "2.4.1"
3
+ __version__ = "2.4.2"
4
4
  __license__ = "MIT"
5
5
 
6
6
  from .converter import (
@@ -32,10 +32,24 @@ STANDALONE_IMAGE_PATTERN = re.compile(
32
32
  )
33
33
  MARKDOWN_LINK_PATTERN = re.compile(r"\[[^\]\n]+\]\([^\)\n]+\)")
34
34
  INLINE_CODE_SPAN_PATTERN = re.compile(r"(?<!`)`[^`\n]+`(?!`)", flags=re.DOTALL)
35
+ # Emphasis delimiters must satisfy CommonMark's minimal flanking requirement:
36
+ # an opening run is not followed by whitespace and a closing run is not preceded
37
+ # by whitespace. Enforcing this keeps a stray, whitespace-flanked delimiter
38
+ # (e.g. the literal ``**`` in ``閉じ ** が``) from being paired at all.
39
+ #
40
+ # For ``**`` and ``~~`` the body additionally may not contain the same delimiter
41
+ # run (``(?:(?!\*\*).)+?`` / ``(?:(?!~~).)+?``). Without this, a dangling opener
42
+ # with no valid closer of its own (``**oops ** and **70.9%→83.0%**``) would scan
43
+ # past the literal stray and steal a *later* well-formed span's closing marker,
44
+ # shifting the pairing and corrupting that span's ZWSP placement. Bounding the
45
+ # body to a single run makes the regex pair the same markers CommonMark does.
46
+ # (The single-``*`` italic body is intentionally not bounded this way: italics
47
+ # legitimately wrap ``**bold**`` and ``*`` is heavily overloaded, so it keeps the
48
+ # whitespace guard only.)
35
49
  EMPHASIS_PATTERNS = (
36
- re.compile(r"(?<!\*)\*\*(.+?)\*\*(?!\*)", flags=re.DOTALL),
37
- re.compile(r"(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)", flags=re.DOTALL),
38
- re.compile(r"~~(.+?)~~", flags=re.DOTALL),
50
+ re.compile(r"(?<!\*)\*\*(?!\s)((?:(?!\*\*).)+?)(?<!\s)\*\*(?!\*)", flags=re.DOTALL),
51
+ re.compile(r"(?<!\*)\*(?!\*)(?!\s)(.+?)(?<!\s)(?<!\*)\*(?!\*)", flags=re.DOTALL),
52
+ re.compile(r"~~(?!\s)((?:(?!~~).)+?)(?<!\s)~~", flags=re.DOTALL),
39
53
  )
40
54
  INLINE_CODE_PLACEHOLDER_PATTERN = re.compile(r"\ufff0code\d+\ufff1")
41
55
  PROTECTED_UNDERSCORE_SPAN_PATTERN = re.compile(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: slack-markdown-parser
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: Convert LLM Markdown into Slack Block Kit messages
5
5
  Author: darkgaldragon
6
6
  License-Expression: MIT