@@ -409,7 +409,8 @@ def to_html(text: str, docformat: str = 'numpy,google', *,
409
409
return _md .reset ().convert (md )
410
410
411
411
412
- def to_markdown (text : str , docformat : str = 'numpy,google' , * ,
412
+ def to_markdown (text : str , * ,
413
+ docformat : str = None ,
413
414
module : pdoc .Module = None , link : Callable [..., str ] = None ):
414
415
"""
415
416
Returns `text`, assumed to be a docstring in `docformat`, converted to markdown.
@@ -418,7 +419,13 @@ def to_markdown(text: str, docformat: str = 'numpy,google', *,
418
419
resolved) and `link` is the hyperlinking function like the one in the
419
420
example template.
420
421
"""
421
- assert all (i in (None , '' , 'numpy' , 'google' ) for i in docformat .split (',' )), docformat
422
+ if docformat is None :
423
+ docformat = getattr (getattr (module , 'obj' , None ), '__docformat__' , 'numpy,google ' )
424
+ docformat , * _ = docformat .lower ().split ()
425
+ if not (set (docformat .split (',' )) & {'' , 'numpy' , 'google' }):
426
+ warn ('__docformat__ value {!r} in module {!r} not supported. '
427
+ 'Supported values are: numpy, google.' .format (docformat , module ))
428
+ docformat = 'numpy,google'
422
429
423
430
text = _ToMarkdown .admonitions (text , module )
424
431
0 commit comments