Giter Club home page Giter Club logo

typedoc-theme-dmt's Introduction

@typhonjs-typedoc/typedoc-theme-dmt

NPM Code Style License Discord Twitch

Provides a customizable UX augmentation to the default TypeDoc theme bringing final mile fit and finish. The approach taken is not to provide a theme replacement, but an augmentation of the output from the default theme providing enhanced usability, features, and polish. A large benefit to this approach is that it allows the Default Modern Theme (DMT) to keep up with new releases and features of TypeDoc.

Installation:

package.json:

{
   "devDependencies": {
      "@typhonjs-typedoc/typedoc-theme-dmt": "^0.2.0-next.1",
      "typedoc": "^0.25.10"
   }
}

Features:

The Default Modern Theme (DMT) achieves enhanced usability through replacing several components of the default theme with Svelte powered implementations. This includes the navigation index and search capabilities. Other changes from the default theme include enhanced styles and usage of modern CSS features like container queries to provide better font size changes for different screen orientations.

Optimization:

At this point the DMT and the core default theme is trading features as features originally in the DMT make way to the core default theme of Typedoc. The primary goal of the DMT is to make the actual majority developer experience the best for those viewing documentation on a desktop computer w/ a good internet connection. This is opposed to the core default theme that tries to make a compromise between the worst / 99th percentile user say on a "2G" connection better at the expense of the actual bulk of users using Typedoc. There are various tweaks in the DMT over the core default theme to make the mainline use case better.

Accessibility:

The DMT styles enhance accessibility making keyboard navigation clear and concise.

There are additional keyboard hotkeys available (for macOS "Alt" is the "Option / โŒฅ" key):

  • <Alt-C>: Focus main content.
  • <Alt-E>: Expand / collapse all navigation folders.
  • <Alt-H>: Open / close the help panel.
  • <Alt-I>: Go to home page / main index.html
  • <Alt-M>: If there is a modules.html index then go to it.
  • <Alt-N>: Scroll to current page in navigation panel and focus it.
  • <Alt-O>: If available, focus first anchor in On This Page container.
  • <Alt-S>: Show and focus the main search entry.

When using the navigation index you may press <Alt> when opening / closing a folder and it will open or close all children folders underneath.

Configuration:

typedoc.json / includes all extra DMT options with comments (JSON5):

{
  // Add the DMT plugin.
  "plugin": [
    "@typhonjs-typedoc/typedoc-theme-dmt"
  ],

  // Set the theme.
  "theme": "default-modern",

  // -----------------------------------------------------------------------------------------------------------------

  // The following options are specific to the Default Modern Theme. Default options are listed unless otherwise specified.

  // Set a local file path or URL to set as the favicon.
  "dmtFavicon": "./assets/favicon.ico",

  // An array of user specified "icon links" that are placed in toolbar links. An example entry is included below.
  "dmtLinksIcon": [
    {
      "icon": "./assets/icons/custom-icon.png", // File path or URL to image.
      "title": "My Custom Link",                // Tooltip to display as "title".
      "url": "<URL>"                            // URL for link.
    }
  ],

  // An object with preconfigured "icon links" for popular services that are placed in toolbar links.
  // All current services supported are listed, but choose the ones you use.
  "dmtLinksService": {
    "Discord": "<URL>",
    "GitHub": "<URL>",
    "BitBucket": "<URL>",
    "GitLab": "<URL>",
    "NPM": "<URL>"
  },

  // Additional navigation sidebar options.
  "dmtNavigation": {
    "moduleIcon": false,  // When true renders module icon.
    "style": 'full'       // A full tree is rendered by default. Other options include 'compact' and 'flat'. The first
                          // renders a full tree, but compacts all intermediary folders with no children and the latter
                          // flattens all module / package paths.
  },

  // May be `false` to disable main search functionality. Otherwise, provide an object
  // search icon in the top link bar is removed.
  "dmtSearch": {
    // When true the main search index stores parent reflection full names. This is set to false by default because when
    // using modules the full module path is shown in search results for all symbols.
    "fullName": false,

    // A positive integer greater than 0 providing a limit on main search query results.
    "limit": 10
  }
}

Synergy:

  • A zero configuration CLI that uses the DMT to automatically generate API documentation from well configured package.json based projects is available via @typhonjs-typedoc/typedoc-pkg. This CLI incorporates ts-lib-docs mentioned next and makes it easy to generate end-to-end documentation.

  • The DMT is used to generate complete API docs for the built-in Typescript library declarations. @typhonjs-typedoc/ts-lib-docs provides several data sources including a TypeDoc plugin that associates all symbols from the built-in TS lib declarations allowing complete end-to-end API docs for your project and the modern web.

Roadmap:

  • Upstream as many things possible back to the main TypeDoc default theme.

  • Continue to refine main search component and setup for better results with large projects / lots of symbols.

  • Finish implementing new "quick search" Svelte component that provides an alternate quick way to search the navigation panel and local file being viewed.

typedoc-theme-dmt's People

Contributors

typhonrt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

typedoc-theme-dmt's Issues

Top level navigation link incorrectly built on child pages

When selecting a class navigation link then selecting the top level navigation link (package name?) the url contains a subdirectory level of 'classes' resulting in a 404 page not found. This is happening for all child pages... modules, classes, interfaces... etc

Expected url: /packageName/index.html
Built url: /packageName/classes/index.html

Very slow navigation build time for files with large number of items

We have a d.ts file that has thousands of interfaces/types (~8800 items)... when selecting this file on the navigation pane the first time it opens fairly fast and lists all entries (~2 seconds... very acceptable). However, if we then close and reopen that same file again it then takes ~25 seconds (with chrome giving a 'Page Unresponsive' popup as it takes so long to respond).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.