docs-ts icon indicating copy to clipboard operation
docs-ts copied to clipboard

Horizontal scrolling in rendered code blocks

Open m-bock opened this issue 3 years ago • 4 comments

Currently docs-ts uses prettier to format markdown before writing out the docs.

The used options are:

const prettierOptions: prettier.Options = {
  parser: 'markdown',
  semi: false,
  singleQuote: true,
  printWidth: 120
}

The code blocks in Jekyll seem to work without horizontal scrolling only if lines don't exceed a 80 characters limit.

Is this intended behavior?

If not, I'd suggest one of those options:

  • Configure Jekyll to use 120 characters as limit (don't know if this is possible)
  • Configure Prettier to use 80 character limit

Or, and this Is what I would suggest:

  • Don't format at all inside docs-ts and encourage the user to use prettier-plugin-jsdoc. This is a much better editing experience. You have more control about the format, plus in the end the actual source file has the same formatting as the docs.

What do you think?

m-bock avatar Mar 09 '21 07:03 m-bock

This is a great point - I would favor changing the prettier config in the codebas (set the printWidth to 80), rather than forcing users to install another dependency. @gillchristian - thoughts?

IMax153 avatar Mar 09 '21 16:03 IMax153

Yeah, I think 80 is quite the default for columns :ok_hand:

gillchristian avatar Mar 09 '21 21:03 gillchristian

True, maybe it's the best to just change that value for the docs generation as @IMax153 suggests. That makes sure the code looks good in Jekyll. Plus it leaves the user the choice which printWidth to use in their codebase.

m-bock avatar Mar 10 '21 05:03 m-bock

I assume that the prettier config in the code base is set to above 80 so that medium length type signatures don't look like a right mess.

waynevanson avatar Apr 15 '21 07:04 waynevanson