sinedied / backslide

:sweat_drops: CLI tool for making HTML presentations with Remark.js using Markdown
https://sinedied.github.io/backslide
MIT License
764 stars 50 forks source link

C++ lambda in code gets garbled in export #69

Open vorner opened 4 years ago

vorner commented 4 years ago

Hello

Let's have a presentation with this slide:

# The Code

```cpp
use_lambda([&]() { return 42; });

(that's a syntax for lambda in C++)

If I do `bs serve`, everything is fine. But if I do `bs export` and then open the generated html, the code gets changed to this:

use_lambda(& { return 42; });



(and everything starting with the tripple slash turns into a gray comment, but that would be correct if such text actually was part of C++ code).

I think something is confused about that `[&]()` sequence, which is a bit link-like. If I put a space before the parentheses (`[&] ()`), everything is fine.

I'm using backslide 2.3.7, on Linux.
sinedied commented 4 years ago

I think it's the regex update for markdown links that got merged some times ago that may be flawed, it should not catch empty links anyway and should avoid anything in-between triple backticks. If you're willing to put a PR for the fix I'll gladly merge it, otherwise I have an almost complete rewrite of the tool in the pipe (long overdue though...) that should address all of these issues.

vorner commented 4 years ago

Sorry, I'm afraid javascript is not my language :-(