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

Maintain leading whitespace when including portions of a file #1626

Open
milesfrain opened this issue Aug 16, 2021 · 2 comments · May be fixed by #1718
Open

Maintain leading whitespace when including portions of a file #1626

milesfrain opened this issue Aug 16, 2021 · 2 comments · May be fixed by #1718
Labels
A-Links Area: Issues with links E-Help-wanted Experience: Help Needed

Comments

@milesfrain
Copy link

Given this anchor:

-- ANCHOR: eqNonEmpty  
instance Eq (NonEmpty a) where
  eq (NonEmpty x xs) (NonEmpty y ys) = x == y && xs == ys    
-- ANCHOR_END: eqNonEmpty

when included as:

## Exercises
1. In the the code below:
    ```haskell
    {{#include ../exercises/chapter6/test/no-peeking/Solutions.purs:eqNonEmpty}}
    ```
    we ...

is expanded to:

## Exercises
1. In the the code below:
    ```haskell
    instance Eq (NonEmpty a) where
  eq (NonEmpty x xs) (NonEmpty y ys) = x == y && xs == ys    
    ```
    we ...

and rendered incorrectly as:

We'd ideally like it to be rendered as:

which requires this markdown source:

## Exercises
1. In the the code below:
    ```haskell
    instance Eq (NonEmpty a) where
      eq (NonEmpty x xs) (NonEmpty y ys) = x == y && xs == ys    
    ```
    we ...

Things would behave as expected if any indentation before an {{#include ...}} block (4 spaces in this case) was also applied to every line of the included file (and not just the first line of that file).

https://rust-lang.github.io/mdBook/format/mdbook.html#including-portions-of-a-file

mdbook version: v0.4.12

@ehuss ehuss added A-Links Area: Issues with links E-Help-wanted Experience: Help Needed labels Aug 16, 2021
@ehuss
Copy link
Contributor

ehuss commented Aug 16, 2021

cc #1430 for a similar issue with indentation.

@rchaser53 rchaser53 linked a pull request Jan 2, 2022 that will close this issue
@rchaser53
Copy link

rchaser53 commented Jan 3, 2022

I suffer the same problem. So I sent the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Links Area: Issues with links E-Help-wanted Experience: Help Needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants