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

Code blocks get breaks added between each line #1446

Closed
abraham opened this issue Jan 2, 2019 · 34 comments
Closed

Code blocks get breaks added between each line #1446

abraham opened this issue Jan 2, 2019 · 34 comments
Labels
area: publishing experience issues related to an authors experience publishing. Tags, series, etc. bug smash Approved bugs for the DEV community bug smash bug always open for contribution external contributors welcome contribution is welcome! good first issue good first issues for anyone new to programming and new to the project.

Comments

@abraham
Copy link
Contributor

abraham commented Jan 2, 2019

Describe the bug
Code blocks sometimes get breaks <br> added between each line. You can see it in the one codeblock on A month of Flutter: a look back. It appears to be related to having headers following the code blocks.

To Reproduce

Go to create a new post enter the following markdown and hit "preview".

~~~
function hello() {
  console.log('hello');
}
~~~

~~~
function goodbye() {
  console.log('goodbye');
}
~~~

# header

Expected behavior

The code blocks should not have any blank lines between each line of code.

Screenshots

Correct display when # header is not included:

screenshot from 2019-01-02 14-17-11

Incorrect display when # header is included:

screenshot from 2019-01-02 14-17-00

Desktop (please complete the following information):

  • OS: Ubuntu 18.10
  • Browsers:
    • Chrome 72.0.3626.28
    • Firefox 64.0

Additional context

The broken display only appears to happen when a header follows the code blocks. If I move it between or before the code blocks the breaks don't happen. I'm using v2 of the editor and have not tested with v1.

@jessleenyc jessleenyc added the bug always open for contribution label Jan 8, 2019
@triage-new-issues triage-new-issues bot removed the triage label Jan 8, 2019
@jessleenyc jessleenyc self-assigned this Jan 8, 2019
@jessleenyc
Copy link
Contributor

Interesting, had no idea ~~~ was another way of creating code blocks. We'll look into this. But for now, you might want to try the ``` syntax for creating code blocks. Seems like the back ticks don't create that additional space when a header is included.

@jessleenyc jessleenyc removed their assignment Jan 8, 2019
@stale
Copy link

stale bot commented Apr 8, 2019

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue in 7 days. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If this issue still requires attention, please respond with a comment. Happy Coding!

@stale stale bot added the stale label Apr 8, 2019
@abraham
Copy link
Contributor Author

abraham commented Apr 8, 2019

Still an issue.

@stale stale bot removed the stale label Apr 8, 2019
@jessleenyc jessleenyc added area: publishing experience issues related to an authors experience publishing. Tags, series, etc. good first issue good first issues for anyone new to programming and new to the project. tech: ruby labels Aug 7, 2019
@rhymes rhymes removed the future label Jul 1, 2020
@redencion
Copy link

Hi guys! I would like check it, May I?

@citizen428
Copy link
Contributor

Sure, I'll assign you the issue @redencion, thanks for volunteering! 😃

@redencion
Copy link

redencion commented Aug 12, 2020

Hi guys! Is it normal? when I'm running bin/spring rspec, I got a fail test. I just cloned twice repository and again fail the test. I followed these steps https://docs.forem.com/getting-started/workflow/

@redencion
Copy link

I did PR but something is wrong, added option draft.

@cmgorton cmgorton added bug smash Approved bugs for the DEV community bug smash external contributors welcome contribution is welcome! labels May 4, 2021
@alicenstar
Copy link

Is this still an issue? If so, I would like to take a crack at it.

@cmgorton
Copy link
Contributor

cmgorton commented May 4, 2021

Yes it is @alicenstar . I will assign it to you. Let us know if you have any questions and thanks for your help here!

@alicenstar
Copy link

@cmgorton I am running into an issue setting up the project. I followed all install and setup instructions, but after running bin/startup and running the project locally, I get a URI::BadURIError at /. Both URI are relative error when visiting localhost:3000/. I looked in .env_sample and APP_DOMAIN is set to localhost:3000, so I'm not sure where to go from here.

It cites the error as happening in app/lib/url.rb on the URI.parse line:

  def self.url(uri = nil)
    base_url = "#{protocol}#{domain}"
    return base_url unless uri
    URI.parse(base_url).merge(uri).to_s
  end

I am new to Ruby so any assistance or nudge in the right direction is greatly appreciated. (I am running the project on Ubuntu 20.x on WSL2 if that helps.)

@cmgorton
Copy link
Contributor

cmgorton commented May 4, 2021

Hey! I'm away from my computer until the morning but I pinged our OSS devs to see if any can offer assistance. I'll follow back up in the morning if you haven't received a response before then 😁

@alicenstar
Copy link

alicenstar commented May 5, 2021

I managed to fix the environment variable issue - I'll work on this tomorrow now that I have my environment set up. :)

@cmgorton
Copy link
Contributor

cmgorton commented May 5, 2021

Awesome! If you run in to any more issues just let us know.

@alicenstar
Copy link

Well, unfortunately I am running into more issues. I'm on a Windows machine and my motherboard apparently can't handle having virtualization enabled without shutting down randomly multiple times a day, so I tried to switch to GitPod, but I can't get the project to run locally. I get Command ["foreman start -f Procfile.dev"] failed (which I was also getting in Ubuntu/WSL2) in the first terminal, and Awaiting port 3000... in the second terminal (it just stays frozen there).

@cmgorton
Copy link
Contributor

cmgorton commented May 6, 2021

@alicenstar Thanks for sticking with this through all the errors. I think this might be similar to what another contributor encountered. Here is their comment and if you read below that there is a solution from one of our engineers. Can you let me know if that helps at all?
#13298 (comment)

@alicenstar
Copy link

Thanks for pointing me to that comment - it helped!

@alicenstar
Copy link

Trying to log in as the default admin user in my local environment (so that I can create a comment and test some things) and I am getting this error:

18:10:13 web.1       | Cannot render console from 10.4.11.9! Allowed networks: 127.0.0.0/127.255.255.255, ::1
18:10:13 web.1       | Processing by Devise::SessionsController#create as HTML
18:10:13 web.1       |   Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "user"=>{"email"=>"admin@forem.local", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Continue"}
18:10:13 web.1       | HTTP Origin header (https://3000-white-carp-g4fs8ci6.ws-us03.gitpod.io) didn't match request.base_url (https://3000-white-carp-g4fs8ci6.ws-us03.gitpod.io)
18:10:13 web.1       | Completed 200 OK in 4ms (ActiveRecord: 0.0ms | Allocations: 2977)```

@cmgorton
Copy link
Contributor

cmgorton commented May 6, 2021

Asking in our internal dev channel to see if anyone can help.

@msarit
Copy link
Contributor

msarit commented May 6, 2021

Hi @alicenstar 👋🏾
are you logging into localhost or 127.0.0.1?

@Link2Twenty
Copy link
Contributor

Link2Twenty commented May 6, 2021

Looks like it's gitpod?

Open your .env and change APP_DOMAIN to "your own Gitpod Forem URL without https". Change APP_PROTOCOL to "https"

https://forem.dev/akhil/aftermath-on-clicking-open-in-gitpod-581b

3000-white-carp-g4fs8ci6.ws-us03.gitpod.io

@alicenstar
Copy link

I was attempting to login through GitPod, so maybe that was the issue. I'm trying to recompile now, it's just taking a minute. Things keep freezing.

@Zhao-Andy
Copy link
Contributor

Hi @alicenstar, I'm using Ubuntu 20.x and WSL2 as well! I followed our Windows guide to setup, and it seems like you were most of the way there since you got to run bin/startup. If you find that GitPod is not working out that well, happy to help you triage your Windows setup.

The error message Command ["foreman start -f Procfile.dev"] failed usually is indicative of the server failing to boot -- if you want to post the full error message we'll be able to help you see what's going on.

@alicenstar
Copy link

@Zhao-Andy I had to switch to GitPod because my motherboard apparently can't handle having virtualization enabled without shutting down randomly multiple times a day. I got the project to run fine otherwise, but the random shut downs weren't going to work for me.

I think GitPod's servers might be slowing down this bin/startup process because I've been waiting for it to finish compiling for about an hour now (it's still not done). I'll be able to evaluate any other errors once that's done loading.

@Zhao-Andy
Copy link
Contributor

@alicenstar gotcha, thanks for the clarification!

@alicenstar
Copy link

alicenstar commented May 7, 2021

I think I may possibly have fixed this issue. I am trying to run tests now to be sure, but I am running into an error when trying to run any test (using bundle exec rspec spec/relevant_test_folder): FATAL: database "Forem_test" does not exist.

I tried running tests from the following folders:
spec/system
spec/services/markdown_processor/parser_spec.rb
spec/services/markdown_processor

I tried changing my .env file to this (hard-coding the database name since that was a problem for me before), but I still get this error.
.env:

DATABASE_NAME_TEST=Forem_test
DATABASE_URL_TEST=postgresql://localhost:5432/Forem_test

@rhymes
Copy link
Contributor

rhymes commented May 7, 2021

Hi @alicenstar, can you create the DB manually in the GitPod console? I can think of two options:

  1. createdb Forem_test
  2. psql Forem_development and then you issue CREATE DATABASE Forem_test in the PostgreSQL console

Let us know if that helps, and thank you!

@alicenstar
Copy link

@rhymes That, along with executing rails db:setup again seems to be working! I'm getting some failed tests now, so back to the drawing board. 🙃 Will update if I come to any more roadblocks.

@cmgorton
Copy link
Contributor

cmgorton commented May 7, 2021

@alicenstar thanks again for pushing through all these set backs.
You are doing a wonderful job and we are definitely here to help however we can.

@cmgorton
Copy link
Contributor

Hey @alicenstar wanted to check in and see how you are doing with this issue. Did you have any questions or need any help?

@alicenstar
Copy link

Hey, sorry! Got a little busy the past couple weeks! I'll try to test my solution tonight just to verify it works

@cmgorton
Copy link
Contributor

No worries! We all get busy. Take your time and test it whenever you get a chance. Thanks again for your help.

@alicenstar
Copy link

I unfortunately think I'm going to have to pass issue this to someone else for now. I'm low on time because of my new job, and I'm running into some issues with GitPod.

That's something I want to try to work on (the docs and possibly augmenting the GitPod setup). Hopefully someone can test the work I've done here or use it as a starting point possibly.

@cmgorton
Copy link
Contributor

cmgorton commented May 27, 2021

Thank you for the work you have done so far @alicenstar . We really appreciate it. 🙏

Also congrats on the new job! 🎉

@thirashapw
Copy link

There a another way to add this. try ``` instead of ~~~. Also, combine them together with one code block.

function hello() {
  console.log('hello');
}
function goodbye() {
  console.log('goodbye');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: publishing experience issues related to an authors experience publishing. Tags, series, etc. bug smash Approved bugs for the DEV community bug smash bug always open for contribution external contributors welcome contribution is welcome! good first issue good first issues for anyone new to programming and new to the project.
Projects
None yet