apple / swift-docc

Documentation compiler that produces rich API reference documentation and interactive tutorials for your Swift framework or package.
https://swift.org/documentation/docc
Apache License 2.0
1.14k stars 118 forks source link

Slices of Snippets don't have indentation removed #943

Open Joannis opened 3 weeks ago

Joannis commented 3 weeks ago

Description

When creating a snippet with the following contents, the extra indentation of the shown code is removed to make it more readable:

// snippet.hide
import AsyncHTTPClient
import NIOCore
import Foundation

@main
struct Entrypoint {
    static func main() async throws {
        // snippet.show
        myCode()
        // snippet.hide
    }
}

However, doing the same with slices does not seem to have the same effect:

import AsyncHTTPClient
import NIOCore
import Foundation

@main
struct Entrypoint {
    static func main() async throws {
        // snippet.mySlice
        myCode()
        // snippet.end
    }
}

Checklist

Expected Behavior

I expect the second code to render as the following in markdown:

myCode()

Actual behavior

Indentation is kept, making code unnecessarily indented.

        myCode()

Steps To Reproduce

No response

Swift-DocC Version Information

No response

Swift Compiler Version Information

No response

tayloraswift commented 3 weeks ago

i wasn’t able to reproduce this on version 1.3.0 of swift-docc-plugin:

image

what version are you on?