Although not specifically mentioned in the nbdev documentation.
The directives must be at the top of the cell.
This is specified in the Quarto documentation.
So
# Below is my function
#| export
# No, this cell will NOT get exported.
and
#| export
# Below is my function
# YES, this cell will get exported.
If you have ‘issues’ with the use of #| hide
in Markdown cells, this may help.
https://forums.fast.ai/t/have-a-complete-toc-when-editing-notebook/