Skip to content

fix: Fix non-rendered Markdown in documents - #416

Merged
MarekSuchanek merged 1 commit into
developfrom
fix/markdown
Jul 25, 2026
Merged

fix: Fix non-rendered Markdown in documents#416
MarekSuchanek merged 1 commit into
developfrom
fix/markdown

Conversation

@MarekSuchanek

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the document worker’s Markdown rendering so that additional Markdown constructs (notably fenced code blocks and strikethrough) are rendered into HTML instead of appearing as literal text in generated documents.

Changes:

  • Added pymdown-extensions to the document worker’s Python dependencies and lockfile.
  • Enabled the fenced_code Markdown extension for triple-backtick code blocks.
  • Enabled pymdownx.tilde (configured to disable single-tilde subscript) to support ~~strikethrough~~.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
uv.lock Locks pymdown-extensions (and its dependencies) into the environment to support new Markdown extensions.
packages/dsw-document-worker/pyproject.toml Declares pymdown-extensions as a runtime dependency for the document worker.
packages/dsw-document-worker/dsw/document_worker/model/utils.py Extends render_markdown to enable fenced code blocks and strikethrough rendering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/dsw-document-worker/dsw/document_worker/model/utils.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

packages/dsw-document-worker/dsw/document_worker/model/utils.py:46

  • FENCE_RE only matches fences at column 0, but Python-Markdown’s fenced_code allows up to 3 leading spaces (common inside list items). If the fence is indented, this preprocessor will still rewrite list-like/backslash-ended lines inside the code block, defeating the intent to leave fenced code verbatim.
    # Opening of a fenced code block, mirroring the `fenced_code` extension:
    # a run of at least three backticks or tildes at the start of the line.
    FENCE_RE = re.compile(r'^(?P<fence>`{3,}|~{3,})')

packages/dsw-document-worker/dsw/document_worker/model/utils.py:56

  • Fence closing detection currently requires the line to equal the raw fence after trimming only trailing spaces and does not allow up to 3 leading spaces. This can mis-detect valid closing fences (e.g., indented or with trailing tabs), causing the block to be treated as unterminated and allowing unwanted rewriting inside it.
        # `fenced_code` closes on the exact same marker (same character and
        # length), optionally followed by trailing spaces.
        for index in range(start, len(lines)):
            if lines[index].rstrip(' ') == fence:
                return index

@MarekSuchanek
MarekSuchanek merged commit e25603d into develop Jul 25, 2026
48 checks passed
@MarekSuchanek
MarekSuchanek deleted the fix/markdown branch July 25, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants