SwiftDocOrg / swift-doc

A documentation generator for Swift projects
https://swiftdoc.org
MIT License
1.68k stars 99 forks source link

Separated folders for given type of object.Is it possible? #179

Closed Foriger closed 3 years ago

Foriger commented 4 years ago

The current output is like this :

.build/Documentattion .build/Documentation/Protocol1.md .build/Documentation/Class1.md

We wanted to have something like this

.build/Documentattion .build/Documentation/Protocols/Protocol1.md .build/Documentation/Classes/Class1.md

Is it possible to achieve something similar?

mattt commented 4 years ago

@Foriger No, this is not currently possible. However, I'm in the process of rewriting how routing works, and would be interested to learn more about your use case, as it could inform the implementation. What problem are you trying to solve? Is it purely aesthetics, or are you intending to do additional processing on the generated documentation based on the type of symbol?

Foriger commented 4 years ago

Thank you for your response :)

Our use case is uploading our markdown content to our documentation site generated with Hugo which accepts different types of markdown(In our case we use Goldmark format).

What we want as a structure is similar to what Firebase is offering.

To achieve it there are some things that we do manually:

  1. Generate front matter on top of the page which helps with navigation. Here is an example of what we are inserting on every file:

    ---
    title: Title
    menu:
    references:
    identifier: classes-identifier
    parent: classes
    weight: 2
    ---

    For example, Dokka for Kotlin generates something similar when the output format is specified for Jekyll.

  2. To separate types like in the question above (classes in one dir, enums in other dir, etc.) Hugo requires separate directories for every type plus one empty _index.md file with the front matter in it.

  3. Renaming Home.md to _index.md

Points 1 and 3 are easily done internally, but 2 is a showstopper for us.

We currently use Sourcedocs for markdown generator where file structure is what we want, but there are some bugs in it, and therefore we are considering other options.

mattt commented 4 years ago

@Foriger Thanks for expanding on your use case. I'm working to add JSON and SQLite output formats in an upcoming release, both of which should be a more flexible and extensible option. Do any opportunities jump out to you as far as making those formats more useful for your documentation pipeline?

Foriger commented 4 years ago

@mattt unfortunately no. We need markdown, but I will check the new bet soon to see if there is something that could help us.

mattt commented 4 years ago

@Foriger First, to clarify: swift-doc 1.0.0-beta.5 doesn't include JSON or SQLite output formats, it's primarily a compatibility release for Swift 5.3. Second, what about using a combination of Markdown and JSON or SQLite output?

Foriger commented 4 years ago

Second, what about using a combination of Markdown and JSON or SQLite output?

We could try this, but I'm still pretty sure, that we are markdown and markdown only.

P.S Sorry for delayed response.

luisgustavozup commented 3 years ago

Have you found a solution to create the files into specifcs folders (creating an folder hierarchy for HUGO, etc)? @mattt

b-onc commented 3 years ago

Hello @mattt,

Our usecase requires the docs to be in the same format as the source files. So for source files:

Sources/Controller/Class1.swift
Sources/Manager/Class2.swift
Sources/View/View1.swift

we want the output to be:

Documentation/Controller/Class1.swift
Documentation/Manager/Class2.swift
Documentation/View/View1.swift

I'm putting this here since I think it's related