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

Fix codeblock in codeblock #129

Merged
merged 2 commits into from
Dec 22, 2023
Merged

Conversation

dalance
Copy link
Contributor

@dalance dalance commented Dec 21, 2023

Codeblock which contains ``` will be like below:

````markdown
```rust
let a = 0;
```
````

But the output of mdbook-i18n-helpers seems to be broken like below:

```markdown
```rust
let a = 0;
```
```

This is because codeblock token count is fixed as 3 in reconstruct_markdown.
This PR adds to check the appropriate codeblock token count.

@mgeisler
Copy link
Collaborator

Thanks @dalance for finding and fixing this! I believe the correct place to fix this would actually be in pulldown-cmark-to-cmark. I went looking there and Byron/pulldown-cmark-to-cmark#20 looks related.

I'm happy to fix this here for now, but we should add a TODO comment with a reference to pulldown-cmark-to-cmark to see if we can fix it for everybody.

Comment on lines 560 to 561
/// Check appropriate codeblock token count
fn check_code_block_token_count(group: &[(usize, Event)]) -> usize {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// Check appropriate codeblock token count
fn check_code_block_token_count(group: &[(usize, Event)]) -> usize {
/// Check appropriate codeblock token count
///
/// See https://github.com/Byron/pulldown-cmark-to-cmark/issues/20
/// for a related upstream issue.
fn check_code_block_token_count(group: &[(usize, Event)]) -> usize {

i18n-helpers/src/lib.rs Outdated Show resolved Hide resolved
@mgeisler mgeisler merged commit cfa5e93 into google:main Dec 22, 2023
7 checks passed
@dalance
Copy link
Contributor Author

dalance commented Dec 27, 2023

@mgeisler Thank you for merging this PR.
Could you release 0.3.1 including this?
(Or is there any release plan?)

This is because the problem is a blocking issue of translation on https://github.com/rust-lang/rust-by-example.

@mgeisler
Copy link
Collaborator

mgeisler commented Jan 5, 2024

@mgeisler Thank you for merging this PR. Could you release 0.3.1 including this? (Or is there any release plan?)

This is because the problem is a blocking issue of translation on https://github.com/rust-lang/rust-by-example.

Thanks for reminding me of this! Let me create a release now!

@mgeisler
Copy link
Collaborator

mgeisler commented Jan 5, 2024

I've made a 0.3.1 release! 🎉

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.

None yet

2 participants