Skip to content
Merged
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
7 changes: 7 additions & 0 deletions .chronus/changes/python-addBullet-2025-9-16-16-11-41.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@typespec/http-client-python"
---

Additional fixes to documentation with bullet points
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
{% macro wrap_model_string(doc_string, wrap_string, suffix_string="") %}
{% set original_result = doc_string | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring=wrap_string) %}
{# Check if this is a sphinx documentation line that should not have extra prefix spacing #}
{%- set is_sphinx_doc = doc_string.strip().startswith(':ivar') or doc_string.strip().startswith(':vartype') or doc_string.strip().startswith(':param') or doc_string.strip().startswith(':type') -%}
{# Custom handling for bullet points - normalization is now done in preprocessing #}
{% set enable_custom_handling = "* " in doc_string %}
{%- if enable_custom_handling -%}
{%- set lines = doc_string.split('\n') -%}
{%- set result_lines = [] -%}
{%- for line in lines -%}
{%- if line.startswith('* ') -%}
{# Handle bullet points with proper continuation alignment #}
{%- set bullet_content = line[2:] -%}
{%- set base_indent = wrap_string.lstrip('\n') -%}
{%- set bullet_line = base_indent + ' * ' + bullet_content -%}
{%- set continuation_spaces = base_indent + ' ' -%}
{%- set wrapped = bullet_line | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n' + continuation_spaces) -%}
{%- set _ = result_lines.append(wrapped) -%}
{%- elif line.strip() -%}
{%- set wrapped = line.strip() | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring=wrap_string) -%}
{%- set _ = result_lines.append(wrapped) -%}
{%- else -%}
{%- set _ = result_lines.append('') -%}
{%- endif -%}
{%- endfor -%}
{%- set original_result = result_lines | join('\n') -%}
{%- else -%}
{# Regular text handling #}
{%- set original_result = doc_string | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring=wrap_string) -%}
{%- endif -%}
{% set list_result = original_result.split('\n') %}
{% for line in list_result %}
{% set prefix = "" if loop.index == 1 else " " %}
{%- if is_sphinx_doc and enable_custom_handling -%}
{%- set prefix = "" -%}
{%- else -%}
{%- set prefix = "" if loop.index == 1 else " " -%}
{%- endif -%}
{% set suffix = suffix_string if list_result | length == loop.index %}
{{ prefix }}{{ line }}{{ suffix }}
{% endfor %}
Expand Down
Loading