Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion mdfluence/confluence_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
12 changes: 6 additions & 6 deletions test_package/functional/result.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ and code blocks:</p>
<li>This is the second list item.</li>
</ol>
<p>Here's some example code:</p>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">true</ac:parameter>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">false</ac:parameter>
<ac:plain-text-body><![CDATA[return shell_exec("echo $input | $markdown_script");]]></ac:plain-text-body>
</ac:structured-macro>
</blockquote>
Expand Down Expand Up @@ -205,7 +205,7 @@ inside a list item.</p>
to be indented <em>twice</em> -- 8 spaces or two tabs:</p>
<ul>
<li><p>A list item with a code block:</p>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">true</ac:parameter>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">false</ac:parameter>
<ac:plain-text-body><![CDATA[<code goes here>]]></ac:plain-text-body>
</ac:structured-macro>
</li>
Expand All @@ -218,11 +218,11 @@ in both <code>&lt;pre&gt;</code> and <code>&lt;code&gt;</code> tags.</p>
<p>To produce a code block in Markdown, simply indent every line of the
block by at least 4 spaces or 1 tab.</p>
<p>This is a normal paragraph:</p>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">true</ac:parameter>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">false</ac:parameter>
<ac:plain-text-body><![CDATA[This is a code block.]]></ac:plain-text-body>
</ac:structured-macro>
<p>Here is an example of AppleScript:</p>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">true</ac:parameter>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">false</ac:parameter>
<ac:plain-text-body><![CDATA[tell application "Foo"
beep
end tell]]></ac:plain-text-body>
Expand All @@ -234,15 +234,15 @@ 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:</p>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">true</ac:parameter>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">false</ac:parameter>
<ac:plain-text-body><![CDATA[<div class="footer">
&copy; 2004 Foo Corporation
</div>]]></ac:plain-text-body>
</ac:structured-macro>
<p>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.</p>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">true</ac:parameter>
<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">false</ac:parameter>
<ac:plain-text-body><![CDATA[tell application "Foo"
beep
end tell
Expand Down
4 changes: 2 additions & 2 deletions test_package/unit/test_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_renderer_block_code():
test_code = "this is a piece of code"
test_markup = (
'<ac:structured-macro ac:name="code">'
'<ac:parameter ac:name="linenumbers">true</ac:parameter>\n'
'<ac:parameter ac:name="linenumbers">false</ac:parameter>\n'
"<ac:plain-text-body><![CDATA[this is a piece of code]]></ac:plain-text-body>\n"
"</ac:structured-macro>\n"
)
Expand All @@ -148,7 +148,7 @@ def test_renderer_block_code_with_language():
test_markup = (
'<ac:structured-macro ac:name="code">'
'<ac:parameter ac:name="language">whitespace</ac:parameter>\n'
'<ac:parameter ac:name="linenumbers">true</ac:parameter>\n'
'<ac:parameter ac:name="linenumbers">false</ac:parameter>\n'
"<ac:plain-text-body><![CDATA[this is a piece of code]]></ac:plain-text-body>\n"
"</ac:structured-macro>\n"
)
Expand Down
Loading