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

vue-docgen-cli: Line breaks should behave predictably #1615

Open
Swivelgames opened this issue Oct 19, 2023 · 0 comments
Open

vue-docgen-cli: Line breaks should behave predictably #1615

Swivelgames opened this issue Oct 19, 2023 · 0 comments

Comments

@Swivelgames
Copy link

In Markdown, single line-breaks are ignored, in order to prevent editors for requiring wrapping (See Markdown specification).

This is especially significant when using it with things like JSDoc and other comments, as most codebases enforce strict line length limits in order to make code more readable and fit within smaller panes.

Current behavior

Presently, when vue-docgen-cli encounters a single line-break, it treats this as a true break and inserts a <br/> tag, instead of treating sets of lines as paragraphs, as most Markdown specifications dictate. The result is a bit icky.

To reproduce

The following:

defineProps<{
  /**
   * Msg prop. This prop is displayed in a Heading 1 tag with a green color,
   * in order to give it emphasis. Specifically, it's rendered using an
   * **<h1>** tag.
   *
   * Leaving this empty does not remove the **<h1>** from the DOM.
   *
   * Global <h1> styles will effect the way the `msg` prop appears.
   *
   * @see [Empty HTML Tags](/some/docs-link)
   * @see [H1 Tag - MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements)
   */
  msg: string;
}>();

Produces:

Prop name Description Type Values Default
msg Msg prop. This prop is displayed in a Heading 1 tag with a green color,
in order to give it emphasis. Specifically, it's rendered using an
<h1> tag.

Leaving this empty does not remove the <h1> from the DOM.

Global <h1> styles will effect the way the msg prop appears.
@see Empty HTML Tags
@see H1 Tag - MDN
string -

When sized down, this appears broken:
image

Expected behavior

  • Single line-breaks should be ignored
  • Double line-breaks should be considered paragraph breaks
  • Lines that start with @ should be considered paragraph breaks

In other words:

The following:

/**
 * foo bar
 * baz
 */

Should produce:

foo bar baz /* OR */ <p>foo bar baz</p>

The following:

/**
 * foo bar
 * 
 * baz
 */

Should produce (to follow convention):

<p>foo bar</p><p>baz</p>

or

foo bar<br/><br/>baz

The following:

/**
 * foo bar
 * @baz quux
 */

Should produce:

<p>foo bar</p><p><code>@baz</code> quux</p>

or

foo bar<br/><br/><code>@baz</code> quux

or even just

foo bar<br/><code>@baz</code> quux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant