denoland / doc_components Goto Github PK
View Code? Open in Web Editor NEWA set of components for rendering deno_doc doc nodes
Home Page: https://deno-doc-components.deno.dev
License: MIT License
A set of components for rendering deno_doc doc nodes
Home Page: https://deno-doc-components.deno.dev
License: MIT License
Follow up to #50
@crowlKats notices that independent of JSX library, that when things are refreshed the server appears to be holding onto state the causes the pages to mis-render.
Currently we flatten symbols in namespaces on the doc symbol index page. This was mainly a carry over from docland, where we didn't have a symbol nav on the left of the page.
The target state would be not to flatten symbols on the index, but nest namespace symbols on the left nav, which would allow users to expand a namespace as appropriate.
In dotland we migrated Fresh >= 1.1 (ref denoland/dotland#2554). So now we don't need to use tw
notation in components' class
props.
I'm writing a library that I want to publish to deno.land because Deno's great, and I get free API doc web pages there. But, I'm not super familiar with JSDoc, or Deno's extensions(?) to that format, so I'd love to be able to preview what my docs will look like on deno.land during development.
Currently, the closest I can do locally is deno doc myMod.ts
to see what docs get generated, but that doesn't show me how some web-only things will work:
{@link terms}
workIf I want to see the docs rendered, I've got to publish a build to deno.land/x/, see my bugs, patch, and repeat.
I was hoping to make a quick tool that would use doc_components and let me see its output locally.
However, since doc_components uses import maps, I must mirror those import maps in my tool. And there seems to currently be a bug in deno install
that makes import maps not work for installed codebases, which means I won't be able to publish my tool and have others easily use it.
My main goal is to be able to generate docs locally that look like they'll look on deno.land. So the straightforward options are:
deno install
ing import maps.Inferring public properties from a class's constructor is not supported.
input :
export class TrieNode {
constructor(
public wordCount: number = 0,
public prefixCount: number = 0,
public readonly children = new Map<string, TrieNode>(),
) {}
}
output:
export declare class TrieNode {
wordCount: number;
prefixCount: number;
readonly children: Map<string, TrieNode>;
constructor(wordCount?: number, prefixCount?: number, children?: Map<string, TrieNode>);
}
https://deno.land/x/[email protected]/implement-trie-ii-prefix-tree/TrieNode.ts?source
The selectable signature shouldn't be selectable anymore. This makes it difficult for a user to select other parts of the signature if they want and once symbol linking is enabled, people may very well want to navigate to other symbols from the signature instead of having to scroll down to the expansion.
The below lowlight.highlight
call seems throwing error if the language is unknown.
doc_components/doc/markdown.tsx
Line 31 in 782b6b8
This causes error in the following page:
https://jsdoc.app/tags-inline-link.html shows links in the format {@link SomeClass#method}
, but deno_doc (or deno.land?) doesn't seem to support that format.
For example, at https://deno.land/x/[email protected]/mod.ts I just see
which is getting rendered as:
For example: https://deno.land/x/[email protected]/mod.ts
The Module Doc component collapses the two column when in mobile, Index page should as well.
I got this error:
Listening on: http://0.0.0.0:3100/
[uncaught application error]: TypeError - Cannot read properties of undefined (reading 'toLowerCase')
request: { url: "http://0.0.0.0:3100/", method: "GET", hasBody: false }
response: { status: 404, type: undefined, hasBody: false, writable: true }
at file:///Users/hash/Documents/GitHub/doc_components/doc.ts:63:44
at Array.find (<anonymous>)
at getIndex (file:///Users/hash/Documents/GitHub/doc_components/doc.ts:63:24)
at ModulePathIndexPanel (file:///Users/hash/Documents/GitHub/doc_components/module_path_index_panel.tsx:152:23)
at renderFunctionalComponent (https://deno.land/x/[email protected]/core.ts:160:18)
at _render (https://deno.land/x/[email protected]/core.ts:134:70)
at https://deno.land/x/[email protected]/core.ts:46:17
at Array.forEach (<anonymous>)
at appendChildren (https://deno.land/x/[email protected]/core.ts:41:12)
at Object.h (https://deno.land/x/[email protected]/core.ts:286:3)
[error] TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at file:///Users/hash/Documents/GitHub/doc_components/doc.ts:63:44
at Array.find (<anonymous>)
at getIndex (file:///Users/hash/Documents/GitHub/doc_components/doc.ts:63:24)
at ModulePathIndexPanel (file:///Users/hash/Documents/GitHub/doc_components/module_path_index_panel.tsx:152:23)
at renderFunctionalComponent (https://deno.land/x/[email protected]/core.ts:160:18)
at _render (https://deno.land/x/[email protected]/core.ts:134:70)
at https://deno.land/x/[email protected]/core.ts:46:17
at Array.forEach (<anonymous>)
at appendChildren (https://deno.land/x/[email protected]/core.ts:41:12)
at Object.h (https://deno.land/x/[email protected]/core.ts:286:3)
simply change to file?.toLowerCase()
here works, but might need some typing fix.
https://github.com/denoland/doc_components/blob/main/doc.ts#L63
Document pages provide us with copy buttons allowing us to copy import statements easily. For instance you can see one here: https://deno.land/[email protected]/fmt/colors.ts
Turned out that this button did nothing. I quickly looked into it to find that the onclick
attribute is set as a string with weird newline as well as unintentional escape characters of double quotes ("
is converted to "
).
<button class="tw-wu5gnb" onclick="navigator?.clipboard?.writeText("import * as mod from "https://deno.land/[email protected]/fmt/colors.ts";
");">
I'm pretty sure we need to carefully construct the value for the onclick attribute so that copy buttons work as expected. I suppose the straightforward way to fix it is to use client-side JavaScript to set the click handler instead of using string in the onclick
attribute, though I'm not sure if it's the right direction.
Hey Deno fam, just a small UI issue I came across recently on deno.land. When viewing the doc view of a module, like dax
for example, the readonly
tag has no spacing between it and the variable name in question.
Here's a screenshot to highlight what I'm talking about, in case the link above does not show it:
Thanks!
The module index (https://deno-doc-components.deno.dev/#moduleindex) should only show one level deep and nest.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.