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

Add a mechanism to escape '+' fragments #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pganssle
Copy link
Contributor

@pganssle pganssle commented Nov 6, 2020

Prior to this change, it was not possible to start a line with + at all, which is particularly problematic when you have a diff in literal blocks.

Possibly a better long-term fix for this problem would be to disable all pre-processing between triple-backticks, but the ability to escape + at the beginning of a line seems useful in itself and is much easier to implement.

Prior to this change, it was not possible to start a line with `+` at
all, which is particularly problematic when you have a diff in literal
blocks.

Possibly a better long-term fix for this problem would be to disable all
pre-processing between triple-backticks, but the ability to escape `+`
at the beginning of a line seems useful in itself and is much easier to
implement.
@dploeger dploeger requested a review from mrmanc November 8, 2020 11:05
@@ -62,13 +62,22 @@
| replace:'<backgroundimageopacity>','<!-- .slide: data-background-opacity="'
| replace:'</backgroundimageopacity>','" -->'
%}{%
assign first_char = line | strip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it important to remove the strip filter? I think this is there to make sure we still detect indented fragments. Looking at your change locally it looks like the indented fragment now renders with it’s parent rather than as a separate step.

@mrmanc
Copy link
Collaborator

mrmanc commented Sep 6, 2022

I’ve found that this also impacts mermaid diagrams which have indented + symbols in the class diagram syntax, e.g.

class Deck {
  + shuffle()
  + getCards()
  + deal()
}

mrmanc added a commit that referenced this pull request Jan 6, 2025
This was causing issues with Mermaid state diagrams, as the `*` in the start and end nodes (`[*]`) was being interpreted as emphasis (`<em>` tags were finding their way into the DOM). I found inspiration in [this solution](https://revealjs.com/math/#markdown) in the reveal.js docs which uses a single backtick to wrap text in a `<code>` block, which prevents marked (the JS Markdown processor used by reveal.js) from processing the text as markdown. To accommodate this change I’ve tweaked our JS to strip the code tag out of the Mermaid diagram code.

This change may also provide an alternative approach for #35.

I’ve upgraded Mermaid to default to 11.0.2, and users can now override this version in their `config.yml` like this: `mermaid_version: 11.0.2`.

11.0.2 is the most recent which didn’t introduce weird rendering issues with state diagrams which I’ve not spent time investigating.
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

Successfully merging this pull request may close these issues.

2 participants