Skip to content

Preserve Markdown callout blockquote lines in docbuilder style docstring formatting + merge body#757

Open
qgallouedec wants to merge 8 commits intohuggingface:mainfrom
qgallouedec:rtl-in-blockquote
Open

Preserve Markdown callout blockquote lines in docbuilder style docstring formatting + merge body#757
qgallouedec wants to merge 8 commits intohuggingface:mainfrom
qgallouedec:rtl-in-blockquote

Conversation

@qgallouedec
Copy link
Copy Markdown
Member

Same as #756, but wraps the text:

from doc_builder.style_doc import style_docstring


test_docstring = """Function description

Params:
    x (`int`): This is x.

> [!NOTE]
> This is a note.
> This is still part of the note.
"""

print(style_docstring(test_docstring, 119)[0])
$ python demo.py 
Function description

Params:
    x (`int`): This is x.

> [!NOTE]
> This is a note. This is still part of the note.
from doc_builder.style_doc import style_docstring


text = """Function description

Params:
    x (`int`): This is x.

> [!NOTE]
> This is a very very very very long note that should be wrapped and keep the prefix.
"""
print(style_docstring(text, 32)[0])
Function description

Params:
    x (`int`): This is x.

> [!NOTE]
> This is a very very very very
> long note that should be
> wrapped and keep the prefix.

qgallouedec and others added 6 commits February 25, 2026 15:41
- Update regex to capture markdown blockquote lines and callout headers.
- Implement function to format blockquote text while preserving prefixes.
- Modify style_docstring to merge consecutive callout body lines.
- Add tests to verify correct formatting and wrapping of blockquote content.
Copy link
Copy Markdown
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

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

Are you sure we are keeping the expected behavior as needed in huggingface/trl#5172:

> [!NOTE]
> We want to keep the lists:
> - Item 1
> - Item 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants