# Documenter handling Internal (private) modules

**URL:** <https://discourse.julialang.org/t/documenter-handling-internal-private-modules/39242>\
**Category:** General Usage\
**Tags:** documentation, documenter, module\
**Created:** [May 10, 2020, 7:35pm UTC](https://discourse.julialang.org/t/documenter-handling-internal-private-modules/39242 "2020-05-10T19:35:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Post date:** [May 10, 2020, 7:35pm UTC](https://discourse.julialang.org/t/documenter-handling-internal-private-modules/39242/1 "2020-05-10T19:35:46Z")

</div>

I am working on the documentation for module that mostly just bridges the gap between Julia and a C library. There are two methods that I expose that are fully written in Julia because they do not have a counterpart in in the C library but provide functionality that is needed.

These two methods share a bunch of other methods to do what they need to do. So I put all this code in an “internal” module which just exports the two important public methods. Then the parent module re-exports those methods so that the client can easily access this functionality.

The issue is that the Documenter, when listing those two functions, prefixes them with the internal module even though the caller doesn’t need to know about module at all. I’ve searched the Documenter instructions and so far haven’t stumbled upon any flag I could pass to `makedocs` or `@docs` to trim the module from the name. Anyone know of a way to handle this? Or is the recommendation to just move the exported function up to the main module?

Basically I have this:

```julia
module MyModule

module InternalMod
    export func1

    """
        func1()
    """
    function func1() = 1

end

using .InternalMod
export func1

end

```

When using `@docs` in the markdown documentation for `func1` the function name is `MyModule.InternalMod.func1()` and I would prefer to just have `MyModule.func1()`.

---

<div class="post-metadata">

**Author:** ![mortenpi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mortenpi/32/158_2.png) [@mortenpi](https://discourse.julialang.org/u/mortenpi)\
**Post date:** [May 11, 2020, 3:38am UTC](https://discourse.julialang.org/t/documenter-handling-internal-private-modules/39242/2 "2020-05-11T03:38:23Z")

</div>

> Or is the recommendation to just move the exported function up to the main module?

Yeah, that’s currently the only way. However, you can always just declare the (public) functions with `function func1 end` in the main module and then implement the methods in the submodule. I.e.

```julia
module MyModule

export func1
function func1 end

module InternalMod
    import ..MyModule: func1
    """
        func1()
    """
    function func1()
        return 1
    end
end

end

```

Just a small design philosophy note: Documenter tries to accurately reflect the code in this situation. If a function is defined in `MyModule.InternalMod`, then Documenter should state that. A feature that would allow you to fudge that information seems counterproductive to me. I think that a slight reorganization of the code is the cleaner solution.
