{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Documentation generator" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [], "source": [ "from fastai.gen_doc.nbdoc import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Generates documentation for `fastai` classes, functions, types. \n", "View documentation inside a Jupyter Notebook with [`show_doc`](/gen_doc.nbdoc.html#show_doc) or at [`docs.fast.ai`](http://docs.fast.ai)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Show the documentation of a function" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

show_doc[source][test]

\n", "\n", "> show_doc(**`elt`**, **`doc_string`**:`bool`=***`True`***, **`full_name`**:`str`=***`None`***, **`arg_comments`**:`dict`=***`None`***, **`title_level`**=***`None`***, **`alt_doc_string`**:`str`=***`''`***, **`ignore_warn`**:`bool`=***`False`***, **`markdown`**=***`True`***, **`show_tests`**=***`True`***)\n", "\n", "
×

No tests found for show_doc. To contribute a test please refer to this guide and this discussion.

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(show_doc, doc_string=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Show the documentation of an `elt` (function, class or enum). `doc_string` decides if we show the doc string of the element or not, `full_name` will override the name shown, `arg_comments` is a dictionary that will then show list the arguments with comments. `title_level` is the level of the corresponding cell in the TOC, `alt_doc_string` is a text that can replace the `doc_string`. `ignore_warn` will ignore warnings if you pass arguments in `arg_comments` that don't appear to belong to this function and `markdown` decides if the return is a Markdown cell or plain text.\n", "\n", "Plenty of examples of uses of this cell can been seen through the documentation, and you will want to *hide input* those cells for a clean final result." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Convenience functions" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

get_source_link[source][test]

\n", "\n", "> get_source_link(**`file`**, **`line`**, **`display_text`**=***`'[source]'`***, **\\*\\*`kwargs`**) → `str`\n", "\n", "\n", "\n", "Returns github link for given file " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(get_source_link)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

show_video[source][test]

\n", "\n", "> show_video(**`url`**)\n", "\n", "
×

No tests found for show_video. To contribute a test please refer to this guide and this discussion.

\n", "\n", "Display video in `url`. " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(show_video)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

show_video_from_youtube[source][test]

\n", "\n", "> show_video_from_youtube(**`code`**, **`start`**=***`0`***)\n", "\n", "
×

No tests found for show_video_from_youtube. To contribute a test please refer to this guide and this discussion.

\n", "\n", "Display video from Youtube with a `code` and a `start` time. " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(show_video_from_youtube)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Functions for internal fastai library use" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

get_exports[source][test]

\n", "\n", "> get_exports(**`mod`**)\n", "\n", "
×

No tests found for get_exports. To contribute a test please refer to this guide and this discussion.

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(get_exports)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Get the exports of `mod`." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

get_fn_link[source][test]

\n", "\n", "> get_fn_link(**`ft`**) → `str`\n", "\n", "\n", "\n", "Return function link to notebook documentation of `ft`. Private functions link to source code " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(get_fn_link)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

get_ft_names[source][test]

\n", "\n", "> get_ft_names(**`mod`**, **`include_inner`**=***`False`***) → `List`\\[`str`\\]\n", "\n", "
×

No tests found for get_ft_names. To contribute a test please refer to this guide and this discussion.

\n", "\n", "Return all the functions of module `mod`. " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(get_ft_names)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

is_enum[source][test]

\n", "\n", "> is_enum()\n", "\n", "
×

No tests found for is_enum. To contribute a test please refer to this guide and this discussion.

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(is_enum)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Check if something is an enumerator." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

import_mod[source][test]

\n", "\n", "> import_mod(**`mod_name`**:`str`, **`ignore_errors`**=***`False`***)\n", "\n", "
×

No tests found for import_mod. To contribute a test please refer to this guide and this discussion.

\n", "\n", "Return module from `mod_name`. " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(import_mod)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "\n", "\n", "> link_docstring(**`modules`**, **`docstring`**:`str`, **`overwrite`**:`bool`=***`False`***) → `str`\n", "\n", "\n", "\n", "Search `docstring` for backticks and attempt to link those functions to respective documentation. " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(link_docstring)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Undocumented Methods - Methods moved below this line will intentionally be hidden" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## New Methods - Please document or move to the undocumented section" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

jekyll_important[source][test]

\n", "\n", "> jekyll_important(**`s`**)\n", "\n", "
×

No tests found for jekyll_important. To contribute a test please refer to this guide and this discussion.

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(jekyll_important)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

jekyll_warn[source][test]

\n", "\n", "> jekyll_warn(**`s`**)\n", "\n", "
×

No tests found for jekyll_warn. To contribute a test please refer to this guide and this discussion.

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(jekyll_warn)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

jekyll_note[source][test]

\n", "\n", "> jekyll_note(**`s`**)\n", "\n", "
×

No tests found for jekyll_note. To contribute a test please refer to this guide and this discussion.

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(jekyll_note)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "hide_input": true }, "outputs": [ { "data": { "text/markdown": [ "

doc[source][test]

\n", "\n", "> doc(**`elt`**)\n", "\n", "
×

No tests found for doc. To contribute a test please refer to this guide and this discussion.

\n", "\n", "Show [`show_doc`](/gen_doc.nbdoc.html#show_doc) info in preview window along with link to full docs. " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show_doc(doc)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "jekyll": { "keywords": "fastai", "summary": "Helper function to build the documentation", "title": "gen_doc.nbdoc" }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 2 }