Skip to content

Conversation

@chriskrycho
Copy link
Contributor

Fixes #89. Let me know if you’d like me to approach any part of this in a different way!

@chriskrycho
Copy link
Contributor Author

I was experimenting with this in The Rust Programming Language and discovered that it’s ending up inserting escape characters in places we don’t want. Example:

|Example|
|-------|
| `>>`  |

This ends up being output as:

|Example|
|-------|
|`\>>`|

This in turn means that if there are multiple passes, e.g. if you have more than one mdBook preprocessor, it ends up repeatedly escaped. 😅

I am looking at the code, but I think the only think that actually needs to be escaped like this in inline code within a table is a pipe?

@chriskrycho chriskrycho force-pushed the escape-code-in-tables branch from 9782ab7 to 37e8dcb Compare November 20, 2024 23:58
@chriskrycho chriskrycho marked this pull request as ready for review November 20, 2024 23:59
@chriskrycho
Copy link
Contributor Author

I updated the implementation per my comment above; it now only escapes `|` specifically in tables—it intentionally does not escape other characters.

Copy link
Owner

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Thanks a lot for tackling this, good work!

There are some minor improvements that I think should be made before merging, centred around clarity and performance.

Thanks again.

@chriskrycho chriskrycho requested a review from Byron November 21, 2024 18:17
Copy link
Owner

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Great, that does it, thanks again!

Unfortunately I forgot to mention that the Make State struct non-exhaustive commit should rather be named fix!: <the subject as before> to instruct the release tool that this is a breaking change.

I will do the rewrites myself before merging.

@Byron Byron force-pushed the escape-code-in-tables branch from 586341d to a85fe39 Compare November 22, 2024 06:21
@Byron Byron merged commit daef56b into Byron:main Nov 22, 2024
2 checks passed
@Byron
Copy link
Owner

Byron commented Nov 22, 2024

@chriskrycho
Copy link
Contributor Author

Ah, excellent – thank you! Will double check commit message formatting going forward if/as I contribute here. Much obliged for the quick turnaround!

@chriskrycho chriskrycho deleted the escape-code-in-tables branch November 22, 2024 16:29
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.

Lack of escape of | within inline code inside of table cell

2 participants