orchidhq / Orchid

Build and deploy beautiful documentation sites that grow with you
https://orchid.run
GNU General Public License v3.0
514 stars 53 forks source link

Package name shortening in menu #283

Closed DanySK closed 4 years ago

DanySK commented 5 years ago

Hi, in projects with deep package structures, menus could be rendered badly, e.g.:

image

Since it is very common for such projects to have a root, I propose to allow users to define a prefix and a shortener. For the exemplified case, I'd like to change it.unibo.alchemist to, for instance, i.u.a.

DanySK commented 4 years ago

@cjbrooks12, how to use the new feature? Are there instructions somewhere?

cjbrooks12 commented 4 years ago

It's not released yet, it will be available in the upcoming 0.18.0 release. My general workflow is to close issues via commit message kewords which moves the issue from "in progress" to "waiting for release" on the project boards.

I should finally be code-complete with 0.18.0 today and will only need to update documentation after that, so you can expect it to be available in the next couple of weeks. I'll make sure to post back here when it is released and point you to the relevant docs.

DanySK commented 4 years ago

Sorry, I was unclear. I meant: how do I use the feature, once 0.18.0 is released?

On Sun, Oct 27, 2019 at 6:49 PM Casey Brooks notifications@github.com wrote:

It's not released yet, it will be available in the upcoming 0.18.0 release. My general workflow is to close issues via commit message kewords https://help.github.com/en/github/managing-your-work-on-github/closing-issues-using-keywords which moves the issue from "in progress" to "waiting for release" on the project boards https://github.com/JavaEden/Orchid/projects/1#column-2106159.

I should finally be code-complete with 0.18.0 today and will only need to update documentation after that, so you can expect it to be available in the next couple of weeks. I'll make sure to post back here when it is released and point you to the relevant docs.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JavaEden/Orchid/issues/283?email_source=notifications&email_token=AAPGH6NBODPAG5F6XZTCL63QQXIDNA5CNFSM4HWU3QZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECLEAJY#issuecomment-546717735, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPGH6IOKAUIARWF5VSGKRDQQXIDNANCNFSM4HWU3QZA .

-- Ing. Dott. Danilo Pianini, PhD

Site: http://www.danilopianini.org/ Phone: +39 320 41 36 573 Hangouts: danilo.pianini@gmail.com

cjbrooks12 commented 4 years ago

I don't have full docs written up for it yet, but there is a new setup format for using "code doc" plugins that you will need to migrate to first. It works mostly the same as what is there now, but there are substantial changes under-the-hood to make it work. There will be some name changes and it requires opting-in to a feature flag during the initial transition (until 0.19.0), and I will be providing a step-by-step migration guide as well.

For using this feature to rename menu items, you'll basically provide an inline Pebble template expression, which allows you to format the name however you'd need, as opposed to me setting up prescribed formats for renaming it. An example will be like the following:

Old Menu Item

theme:
  menu: 
    - type: 'kotlindocPackages' # No way to rename individual menu items
    - type: 'kotlindocClasses' # No way to rename individual menu items

New Menu Item

theme:
  menu: 
    - type: 'sourcedocPages'
      moduleType: 'kotlindoc'
      node: 'packages'
      transform: '{{ title | replace({"it.unibo.alchemist": "i.u.a"}) }}' # Pebble expression to format each menu item title
    - type: 'sourcedocPages'
      moduleType: 'kotlindoc'
      node: 'classes'

Since it's just a Pebble expression, you could even set up custom TemplateFunctions (such as the one in the Starter repo) to write actual code to do more complex formatting if needed/desired.

DanySK commented 4 years ago

I finally tried this function, with a customised Pebble filter, and it's just great. This message is to thank you @cjbrooks12 for your work :pray: :pray: