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

Breaks hide lines feature of mdbook #1

Closed
ashishkujoy opened this issue Apr 6, 2024 · 5 comments
Closed

Breaks hide lines feature of mdbook #1

ashishkujoy opened this issue Apr 6, 2024 · 5 comments

Comments

@ashishkujoy
Copy link

mdbook provide a feature to hide some line from code block. As explained here . I am trying to use mdbook-repl preprocessor to have some javascript example in my book. But mdbook-repl is making the code line visible.

book.toml

[book]
authors = []
language = "en"
multilingual = false
src = "src"
title = "Javascript"

[preprocessor.repl]
# iframe url
src = "https://mr-addict.github.io/mdbook-repl/embed/"

# enable javascript repl and lazy loading
javascript.enable = true
javascript.loading = "lazy"

[output.html.code.hidelines]
javascript = "~"

markdown from chapter

~const somefunction = () => {
    console.log(3 + 4);
~}

Expected view(this is without javascript.enable = true)
Screenshot 2024-04-06 at 10 55 52 PM

Actual view(with javascript.enable = true)
Screenshot 2024-04-06 at 10 56 44 PM

@MR-Addict
Copy link
Owner

Thank you for your feedback. I'm glad that my project helps you.

I don't know this mdbook trick before. However I don't know that is it actually necessary to include this feature. Because you can just remove these lines in your codeblock rather than using a prefix to hide it.

I'll take a consideration and do some experiments. Tell me if you do need this feature, I can create a new release based for it.

@ashishkujoy
Copy link
Author

Yes this feature is quite useful. At multiple places I want to hide some code and only keep an important section of code visible to the reader. This use case usually occur when showing some incremental changes for a function.
At each step reader need to see code running. If some part is removed from code block, it may not run as aspected.

@MR-Addict
Copy link
Owner

Okay then I'll create a new release about it.

Feel free to tell me if you have any other questions or suggestions.

@MR-Addict
Copy link
Owner

I have create a new release about it, you can check it out here.

@ashishkujoy
Copy link
Author

Thanks for the feature.

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

No branches or pull requests

2 participants