gcanti / docs-ts

A zero-config documentation tool for my TypeScript projects
https://gcanti.github.io/docs-ts/
MIT License
101 stars 17 forks source link

Horizontal scrolling in rendered code blocks #33

Open m-bock opened 3 years ago

m-bock commented 3 years ago

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:

Or, and this Is what I would suggest:

What do you think?

IMax153 commented 3 years ago

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?

gillchristian commented 3 years ago

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

m-bock commented 3 years ago

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.

waynevanson commented 3 years ago

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.