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

Peer Headers with the second Header in a blockquote causes a bad section close #7

Open
LeviRosol opened this issue Nov 12, 2017 · 4 comments

Comments

@LeviRosol
Copy link

That subject line probably makes little sense, so here's an example. If you put this in the jsfiddle in the readme, you'll see the bad output:

const src = `## Great stuff {.jumbotron}
lorem

___
> ## section 2
> click me {.btn .btn-default}`;

results in

<section class="jumbotron">

<h2 class="jumbotron">eat stuff</h2>

<p>lorem</p>

<hr>

<blockquote class="btn btn-default">

</section>

<section>

<h2>section 2</h2>

<p>click me</p>

</section>

</blockquote>

I'm going to make an attempt at fixing this and will submit a PR if I get it, but wanted to post here first incase you know a quick fix.

@arve0
Copy link
Owner

arve0 commented Nov 12, 2017

Thanks for reporting! I do not have a quick fix, so have a go :octocat:

@LeviRosol
Copy link
Author

Ok, i have a "fix" but am hung up on one thing. Currently this commit closes out the section before starting a blockquote, however, i'm getting an extra closing </section>

thoughts on preventing that?

WeWriteCode@57cf99b

@arve0
Copy link
Owner

arve0 commented Nov 16, 2017

I'm unsure if this is an easy fix. Take for example this

> block quote with
> # header
> qwerty

What should the expected output be? Maybe you can add what you expect to some cases?

@LeviRosol
Copy link
Author

I needed to revisit this due to the bad HTML my changes were generating. I've since fixed the support for blockquotes, as well as enabled html in the test runner, and accounted for HTML blocks as well.

To be honest, I'm really not a fan of the code that it took to accomplish this, but in the end, it does seem to work well. I did add tests for all of the scenarios I had, and all are passing.

Feel free to pull from my fork / refactor / incorporate if you think there's value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants