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

Parsing issue with \note #444

Closed
tlienart opened this issue Apr 5, 2020 · 2 comments · Fixed by #448
Closed

Parsing issue with \note #444

tlienart opened this issue Apr 5, 2020 · 2 comments · Fixed by #448
Labels
bug Something isn't working md-parse wip

Comments

@tlienart
Copy link
Owner

tlienart commented Apr 5, 2020

\newcommand{\note}[1]{@@note @@title ⚠ Note@@ @@content #1 @@ @@}
\note{This assumes that you're working on a user folder with final URL looking like 
`username.github.io`. See [this example](https://github.com/tlienart2/tlienart2.github.io) for 
instance.}

Screen Shot 2020-04-05 at 17 20 58

@tlienart tlienart added bug Something isn't working md-parse labels Apr 5, 2020
@tlienart
Copy link
Owner Author

tlienart commented Apr 5, 2020

A bit of a shitty one to debug...

Here's a MWE

julia> s = read("index.md", String)
"\\newcommand{\\note}[1]{@@note @@title Note@@ @@content #1 @@ @@}\n\n\\note{A `B` C}\n\nD\n"

julia> s |> fd2html
"<div class=\"note\"><div class=\"title\">Note</div> <div class=\"content\">A <code>B</code> C</div></div><code>B</code> C&#125;</p>\n<p>D"

Shortened

s = "\\newcommand{\\note}[1]{#1} \\note{A `B` C} D" |> fd2html

--> issue with a code block inside a latex command.

@tlienart
Copy link
Owner Author

tlienart commented Apr 10, 2020

Ok so turns out this is a bit of a nasty one, due to the PR introducing double brace blocks there's now a two-part search for ocblocks, each one checks whether outer blocks contain "inner" blocks but independently of each other. So what happens is:

  • first search finds code block
  • second search finds LXB but doesn't check the first blocks
  • both are still active --> double insertion

this is easy to fix by extracting the "look for inner" part into something that's done on the vcat of blocks. fix pending

I'll also add a batch of tests with nesting of latex-like commands, that stuff should be rock solid.

tlienart added a commit that referenced this issue Apr 10, 2020
@tlienart tlienart mentioned this issue Apr 10, 2020
tlienart added a commit that referenced this issue Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working md-parse wip
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant