From ec323783065568683b1f347113dac6aae5f8cb8b Mon Sep 17 00:00:00 2001
From: geopanther
Date: Fri, 12 Jun 2026 21:00:12 +0200
Subject: [PATCH] chore: disable line numbers in Confluence code blocks
---
CHANGELOG.md | 1 +
mdfluence/confluence_renderer.py | 2 +-
test_package/functional/result.xml | 12 ++++++------
test_package/unit/test_renderer.py | 4 ++--
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1f99f3c..ab879e1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Disable line numbers in Confluence code blocks for cleaner rendering
- Use stdlib `html.parser.HTMLParser` for robust HTML-to-XHTML conversion instead of regex
- Use dynamic default branch detection in publish-release script
diff --git a/mdfluence/confluence_renderer.py b/mdfluence/confluence_renderer.py
index 0bb4415..79df2ce 100644
--- a/mdfluence/confluence_renderer.py
+++ b/mdfluence/confluence_renderer.py
@@ -274,7 +274,7 @@ def block_code(self, code, info=None):
if info is not None:
lang_parameter = self.parameter(name="language", value=info)
root_element.append(lang_parameter)
- root_element.append(self.parameter(name="linenumbers", value="true"))
+ root_element.append(self.parameter(name="linenumbers", value="false"))
root_element.append(self.plain_text_body(code))
return root_element.render()
diff --git a/test_package/functional/result.xml b/test_package/functional/result.xml
index a93e555..44290d7 100644
--- a/test_package/functional/result.xml
+++ b/test_package/functional/result.xml
@@ -96,7 +96,7 @@ and code blocks:
This is the second list item.
Here's some example code:
-true
+false
@@ -205,7 +205,7 @@ inside a list item.
to be indented twice -- 8 spaces or two tabs:
A list item with a code block:
-true
+false
]]>
@@ -218,11 +218,11 @@ in both <pre> and <code> tags.
To produce a code block in Markdown, simply indent every line of the
block by at least 4 spaces or 1 tab.
This is a normal paragraph:
-true
+false
Here is an example of AppleScript:
-true
+false
@@ -234,7 +234,7 @@ are automatically converted into HTML entities. This makes it very
easy to include example HTML source code using Markdown -- just paste
it and indent it, and Markdown will handle the hassle of encoding the
ampersands and angle brackets. For example, this:
-true
+false
© 2004 Foo Corporation
]]>
@@ -242,7 +242,7 @@ ampersands and angle brackets. For example, this:
Regular Markdown syntax is not processed within code blocks. E.g.,
asterisks are just literal asterisks within a code block. This means
it's also easy to use Markdown to write about Markdown's own syntax.
-true
+false
'
- 'true\n'
+ 'false\n'
"\n"
"\n"
)
@@ -148,7 +148,7 @@ def test_renderer_block_code_with_language():
test_markup = (
''
'whitespace\n'
- 'true\n'
+ 'false\n'
"\n"
"\n"
)