Skip to content

Maintain leading whitespace when including portions of a file #1626

Open
@milesfrain

Description

@milesfrain

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LinksArea: Issues with linksE-Help-wantedExperience: Help Needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions