mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 12:08:28 +00:00
add hideDescription flag to JsDoc
This commit is contained in:
parent
3992356517
commit
5733e00908
@ -2,7 +2,7 @@ import jsdoc from '../../../doc.json'; // doc.json is built with `npm run jsdoc-
|
|||||||
const docs = jsdoc.docs.reduce((acc, obj) => Object.assign(acc, { [obj.longname]: obj }), {});
|
const docs = jsdoc.docs.reduce((acc, obj) => Object.assign(acc, { [obj.longname]: obj }), {});
|
||||||
import { MiniRepl } from './MiniRepl';
|
import { MiniRepl } from './MiniRepl';
|
||||||
|
|
||||||
export function JsDoc({ name, h = 3 }) {
|
export function JsDoc({ name, h = 3, hideDescription }) {
|
||||||
const item = docs[name];
|
const item = docs[name];
|
||||||
if (!item) {
|
if (!item) {
|
||||||
console.warn('Not found: ' + name);
|
console.warn('Not found: ' + name);
|
||||||
@ -16,7 +16,7 @@ export function JsDoc({ name, h = 3 }) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!!h && <CustomHeading>{item.longname}</CustomHeading>}
|
{!!h && <CustomHeading>{item.longname}</CustomHeading>}
|
||||||
<div dangerouslySetInnerHTML={{ __html: description }} />
|
{!hideDescription && <div dangerouslySetInnerHTML={{ __html: description }} />}
|
||||||
<ul>
|
<ul>
|
||||||
{item.params?.map((param, i) => (
|
{item.params?.map((param, i) => (
|
||||||
<li key={i}>
|
<li key={i}>
|
||||||
|
|||||||
@ -47,6 +47,7 @@ Usage:
|
|||||||
|
|
||||||
- `name`: function name, as named with `@name` in jsdoc
|
- `name`: function name, as named with `@name` in jsdoc
|
||||||
- `h`: level of heading. `0` will hide the heading. Hiding it allows using a manual heading which results in a nav link being generated in the right sidebar.
|
- `h`: level of heading. `0` will hide the heading. Hiding it allows using a manual heading which results in a nav link being generated in the right sidebar.
|
||||||
|
- `hideDescription`: if set, the description will be hidden
|
||||||
|
|
||||||
### Writing jsdoc
|
### Writing jsdoc
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user