doc-builder icon indicating copy to clipboard operation
doc-builder copied to clipboard

Additional directives that would make development easier

Open LysandreJik opened this issue 3 years ago • 8 comments

The following directives would have been helpful when working on huggingface_hub:

  • A directive to specify in which version it was added (equivalent of versionadded)
  • A directive to specify in which version it was changed (equivalent of versionchanged)
  • A directive to specify it is deprecated (equivalent of deprecated)

LysandreJik avatar Mar 31 '22 10:03 LysandreJik

Other directives I find usefule:

  • literalinclude
  • tabularcolumns
  • note
  • warning

adrinjalali avatar Mar 31 '22 11:03 adrinjalali

@LysandreJik Please let me know what kind of syntax you'd like? How does <xyz number> look? (ex: <versionadded 2.5>, <deprecated 3.1>) ?

@adrinjalali for note, we have similar <Tip> object that looks like this: Screenshot 2022-04-06 at 14 03 10

for warning, we have similar <Tip warning> object that looks like this: Screenshot 2022-04-06 at 14 04 22

for tabularcolumns , since .mdx files support both markdown & html, one can supply markdown or html table (with its custom styles)

for literalinclude, I don't have a good idea on how it should be done (cc: @sgugger )

mishig25 avatar Apr 06 '22 12:04 mishig25

It doesn't look like we can easily do everything literalinclude does in just one command. What was the most useful feature you wanted @adrinjalali ? Highlighting lines? Showing line numbers?

sgugger avatar Apr 06 '22 12:04 sgugger

literalinclude is useful when you have python examples (a .py file) and then you want to reference a section of that in a user guide (an .mdx file). It's only useful once we have the "compile a .py into an .mdx" kinda thing working.

adrinjalali avatar Apr 06 '22 12:04 adrinjalali

Indeed, I've found literalinclude being used quite a lot in tokenizers docs as in here

What was the most useful feature you wanted

the feature that is being used in tokenizers is:

    .. literalinclude:: ../../bindings/node/examples/documentation/pipeline.test.ts
        :language: javascript
        :start-after: START setup_pre_tokenizer
        :end-before: END setup_pre_tokenizer
        :dedent: 8

mishig25 avatar Apr 07 '22 10:04 mishig25

This

How does look? (ex: <versionadded 2.5>, <deprecated 3.1>) ?

looks good to me!

LysandreJik avatar Apr 07 '22 19:04 LysandreJik

@mishig25 are versionadded, versionchanged and deprecated already integrated?

albertvillanova avatar May 30 '22 07:05 albertvillanova

@albertvillanova no. But I'll add them by tomorrow 😊

mishig25 avatar May 30 '22 09:05 mishig25