# nbs_to_ctx


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

------------------------------------------------------------------------

<a
href="https://github.com/AnswerDotAI/nbs2ctx/blob/main/nbs2ctx/core.py#L14"
target="_blank" style="float:right; font-size:smaller">source</a>

### find_ipynb_files

>  find_ipynb_files (directory)

*Find all .ipynb files in the directory and its subdirectories.*

``` python
find_ipynb_files('.')
```

    ['./index.ipynb', './00_core.ipynb']

------------------------------------------------------------------------

<a
href="https://github.com/AnswerDotAI/nbs2ctx/blob/main/nbs2ctx/core.py#L19"
target="_blank" style="float:right; font-size:smaller">source</a>

### render_notebook_to_markdown

>  render_notebook_to_markdown (nb_path)

*Convert a Jupyter notebook to markdown, including markdown cells, code
cells, and limited text outputs.*

``` python
render_notebook_to_markdown('./index.ipynb')[:50]
```

    '```python\n#| hide\nfrom nbs2ctx.core import *\n```\n\n'

------------------------------------------------------------------------

<a
href="https://github.com/AnswerDotAI/nbs2ctx/blob/main/nbs2ctx/core.py#L55"
target="_blank" style="float:right; font-size:smaller">source</a>

### generate_xml

>  generate_xml (directory)

*Generate an XML string containing markdown-rendered content from all
notebooks.*

``` python
generate_xml('.')[:150]
```

    '<documents>\n<document index="1">\n<source>00_core.ipynb</source>\n<document_content>\n# nbs_to_ctx\n\n&gt; Turning Jupyter notebooks into LLM-ready context'

------------------------------------------------------------------------

<a
href="https://github.com/AnswerDotAI/nbs2ctx/blob/main/nbs2ctx/core.py#L80"
target="_blank" style="float:right; font-size:smaller">source</a>

### main

>  main (directory:<Directorycontaining.ipynbfiles>, output:<OutputXMLfile>)

*Convert .ipynb files to XML for LLMs*
