Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to render the navigation pane on the left? #2189

Closed
ilg-ul opened this issue Mar 3, 2023 · 13 comments
Closed

Is it possible to render the navigation pane on the left? #2189

ilg-ul opened this issue Mar 3, 2023 · 13 comments
Labels
question Question about functionality
Milestone

Comments

@ilg-ul
Copy link

ilg-ul commented Mar 3, 2023

Is there any way to render the site with the two main panes reversed, i.e. with the navigation pane on the left?

I know that this is a subjective matter, but most sites (including https://typedoc.org/guides/overview/!) has the navigation tree in the left pane.

Thank you!

@ilg-ul ilg-ul added the question Question about functionality label Mar 3, 2023
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 4, 2023

You could do this pretty easily with the customCss option

.container-main {
  flex-direction: row-reverse;
}

@media (min-width: 1024px) {
  .col-content {
    padding-left: 2rem;
    padding-right: 0;
  }
  .col-menu {
    border-left: 0;
    border-right: 1px solid var(--color-accent);
  }
}

@ilg-ul
Copy link
Author

ilg-ul commented Mar 4, 2023

Thank you, this customCss solved the problem.

In case others find this useful too, perhaps it could be automated with an option to directly generate these CSS definitions.

@ilg-ul
Copy link
Author

ilg-ul commented Mar 4, 2023

For those interested to see how a site with the navigation pane on the left looks like, here is my first such project:

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 4, 2023

Adding a flag for every possible configuration is something I do my best to avoid -- goal is to provide a sufficiently customizable output without having to support & test every possible combination on release. (Particularly true for the theme output, since tests there aren't easy to maintain in a useful way)

@ilg-ul
Copy link
Author

ilg-ul commented Mar 4, 2023

I see.

From a maintainer point of view, you are right, customisation options are indeed more difficult to maintain.

However, you should also consider the user perspective; CSS knowledge is at premium and few users are able to create a configuration like the one you suggested before.

If you do not think that customisable theme options are the solution, at least consider adding a page in the documentation with possible custom CSS configurations (start with this one), such that users can directly use them without having to ask for support.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 4, 2023

If multiple people are using the same css it'd probably be better to create a custom theme and release that. https://typedoc.org/guides/themes/

typedoc --plugin ./left-nav-theme.js --theme left-nav 
// @ts-check
// CC0

const td = require("typedoc");
const fs = require("fs");
const { join } = require("path");

const css = `
.container-main {
  flex-direction: row-reverse;
}

@media (min-width: 1024px) {
  .col-content {
    padding-left: 2rem;
    padding-right: 0;
  }
  .col-menu {
    border-left: 0;
    border-right: 1px solid var(--color-accent);
  }
}
`;

class LeftNavigationTheme extends td.DefaultTheme {
  /** @param {td.Renderer} renderer */
  constructor(renderer) {
    super(renderer);

    renderer.once(
      td.Renderer.EVENT_END,
      /** @param {td.RendererEvent} event */
      (event) => {
        const styleCss = join(event.outputDirectory, "assets/style.css");
        fs.appendFileSync(styleCss, css);
      }
    );
  }
}

/** @param {td.Application} app */
exports.load = function (app) {
  app.renderer.defineTheme("left-nav", LeftNavigationTheme);
};

@ilg-ul
Copy link
Author

ilg-ul commented Mar 4, 2023

That's a great idea, a theme would be definitely preferred.

Unfortunately I have no experience with TypeDoc themes (and poor experience with web sites in general), so I might not be the one that can do it at an acceptable quality level. :-(

@Dayday10
Copy link

Dayday10 commented Mar 5, 2023 via email

@ilg-ul
Copy link
Author

ilg-ul commented Mar 8, 2023

Does #2192 bring this feature into the master branch?

@Gerrit0 Gerrit0 added this to the v0.24 milestone Mar 11, 2023
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 11, 2023

It will go into beta for now, I try to avoid large theme changes in patch releases, will be released with 0.24

@ilg-ul
Copy link
Author

ilg-ul commented Mar 11, 2023

Just curious, why not using full semver strings?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 11, 2023

Primarily because I don't want someone to think that there's a guarantee that code written for "1.0.0" will work with "1.1.0" when a new TS version is added, since TS doesn't follow semver and every update has the potential to be a breaking change. (In practice, I think this has only happened a 1-2 times in the past year)

Not strictly following semver also means I feel free to make in-theory breaking changes that in practice likely breaks nobody, like the Shiki upgrade in 0.23.25

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Apr 8, 2023

Released in v0.24.0

@Gerrit0 Gerrit0 closed this as completed Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about functionality
Projects
None yet
Development

No branches or pull requests

3 participants