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

Feature Request: Pass in array of excluded methods in Markdown.random #1052

Closed
cameronbroe opened this issue Oct 25, 2017 · 3 comments
Closed

Comments

@cameronbroe
Copy link

Basically, it would be nice to optionally pass in an array of excluded Markdown methods when calling Faker::Markdown.random so that you can selectively choose what you are randomly getting. I would be willing to submit a PR for this if it is something the community would like.

An example of how it could work would be with a call like this:
Faker::Markdown.random(exclude: [:headers])

Which will perform the random method, but never generate a header. This feature could allow for generating fake blog articles that add headers selectively, but still easily allow adding other elements between Faker::Lorem and Faker::Markdown to make the fake blog articles seem more realistic instead of potentially having 4 sets of headers and no real content between the headers.

@russellschmidt
Copy link
Contributor

I think I got this working for the random method but if you have good ideas about how to test it, I am all ears!

@russellschmidt
Copy link
Contributor

I think it might be cool to solve this problem a different way with what I will call a markdown sandwich (inspired by the s*** sandwich criticism technique). So you can use Markdown.sandwich(5) and you get:

  • header
  • 5 sentence lorem ipsum paragraph
  • random markdown element

so it looks like a real blog post.

Markdown.sandwich(6,3) should produce

  • header
  • 6 sentence lorem paragraph
  • random markdown
  • 6 sentence lorem paragraph
  • random markdown
  • 6 sentence lorem paragraph
  • random markdown

...so a pair of lorem-markdown content repeats 3 times (2nd arg) for longer form stuff.

Here's my PR 1064.

@vbrazo
Copy link
Member

vbrazo commented May 28, 2018

PR merged. Thanks.

@vbrazo vbrazo closed this as completed May 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants