Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Triple quote long examples docs. #42

Merged
merged 5 commits into from
May 1, 2018

Conversation

bryanhelmig
Copy link
Member

Makes those long examples a little more readable.

Copy link
Contributor

@xavdid xavdid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple of minor comment-related things, but it looks good!

.join('\n')}\n${prepend}\`\`\``
: `\`${prepQuote(val)}\``;
const quoteOrNa = (val, triple = false, prepend = '') =>
val ? quote(val, triple, prepend) : '_n/a_';

const formatExample = example => {
const ex = _.isPlainObject(example) ? _.omit(example, SKIP_KEY) : example;
return `* ${quoteOrNa(
// GH parses the newlines in bullets correctly, but it's a good thing to fix
// docs say Infinity for no line break at all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove these comments as they're no longer relevant

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah -- good call!

const quote = (val, triple, prepend = '') =>
triple && val.length > BREAK_LENGTH
? `\`\`\`\n${val
.match(/[^\r\n]+/g)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this section is a little opaque. could you add comments about the desired before and after?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bryanhelmig bryanhelmig merged commit 16c879b into master May 1, 2018
@bryanhelmig bryanhelmig deleted the triple-quote-long-examples-docs branch May 1, 2018 05:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants