Drarig29 / typedoc-plugin-extras

A plugin for TypeDoc which adds extras to the generated documentation
https://drarig29.github.io/typedoc-plugin-extras/
MIT License
13 stars 3 forks source link

Not working with Typedoc 0.24.8 #19

Closed isaacyakl closed 1 year ago

isaacyakl commented 1 year ago

Option Errors

The plugin options are currently not working and Typedoc emits errors such as:

[error] Tried to set an option (favicon) that was not declared. You may have meant:
        version
        json
        navigation
        options
        out
        cname
        gaID
        watch
[error] Tried to set an option (footerTypedocVersion) that was not declared. You may have meant:
        version

Officially Supported Options

Options have been added to Typedoc:

Drarig29 commented 1 year ago

Option Errors

Hey! Can you give more details on your setup? It works for me 🤔

Do you have a line saying [info] Loaded plugin typedoc-plugin-extras?

How do you pass the config options? With a JSON file or with CLI arguments?

I'm asking all of these because TypeDoc's error messages are conveniently different, based on if the option was declared or not at all:

"Unknown option": https://github.com/TypeStrong/typedoc/blob/c1c87c6fdad7175ca11f78bdf9ad4aeb9a9286bc/src/lib/utils/options/options.ts#L287

vs.

"Tried to set an option that was not declared": https://github.com/TypeStrong/typedoc/blob/c1c87c6fdad7175ca11f78bdf9ad4aeb9a9286bc/src/lib/utils/options/options.ts#L322

Officially Supported Options

Thanks for comparing the options this plugin provide with the officially supported options!

customTitle -> name

My custom title option works a bit differently: it doesn't change the project name (like --name), but only the name of the link in the header of all generated pages.

Example with --customTitle "Go back" (taken from here)


customTitleLink -> titleLink

You're right, this was added recently (in typedoc@0.23.17). I'll deprecate customTitleLink in the next release.


gaMeasurementId -> gaID

Wow! I made a mistake blindly resolving a feature request (#17), without checking if it was supported or not...

It is indeed already supported, and produces quite the same output.

We just put the script in different places (see the HTML below). I put the script in the head (recommended), and they put it at the very end of the page.

But I can open an issue on TypeDoc saying that this is not recommended, and I'll deprecate that option too.

<!DOCTYPE html><html class="default" lang="en"><head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=withGaMeasurementId"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', 'def');
</script>
<meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Documentation</title><meta name="description" content="Documentation for Documentation"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/search.js" id="tsd-search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
<div class="tsd-toolbar-contents container">
<div class="table-cell" id="tsd-search" data-base=".">
<div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
<div class="field">
<div id="tsd-toolbar-links"></div></div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li></ul><a href="https://google.com" class="title">Custom</a></div>
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
<div class="container container-main">
<div class="col-content">
<div class="tsd-page-title">
<h2>Documentation</h2></div>

...

<div class="overlay"></div><script async src="https://www.googletagmanager.com/gtag/js?id=withGaID"></script><script>window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'abc');</script></body></html>
isaacyakl commented 1 year ago

gaMeasurementId -> gaID

Yes, I was the one who requested the Google Analytics option which you implemented beautifully. At the time TypeDoc did not support it, but they probably saw that we wanted it and officially added it shortly afterwards.

Drarig29 commented 1 year ago

@isaacyakl ha ok, I didn't notice it was you.

Well, if you look at this commit, apparently the option was added 9 years ago 😅

Can you answer the main subject of this issue? ("not working with 0.24.8")

If you managed to make it work, please tell us how 😉

Drarig29 commented 1 year ago

@isaacyakl I think you may have forgotten to specify --plugin typedoc-plugin-extras, it looks like it's mandatory now: https://github.com/Drarig29/brackets-docs/actions/runs/5432312458/jobs/9879261589

I'll close this issue. Feel free to reopen if it still doesn't work for you, but I'll need to have more context.