Skip to content

Conversation

@wolverian
Copy link

Adds a minor test case that a non-annotated code block matches Not foo.

@sol
Copy link
Owner

sol commented Nov 10, 2025

Hey 👋

Thanks for using markdown-unlit.

Unless there is a specific motivation for this change, I'm not going to merge this at this point.

@wolverian
Copy link
Author

wolverian commented Nov 10, 2025

Hey! So my motivation is that I'd like to contribute a configuration mode where I could use plain indented code blocks as Haskell code. This PR was my first step towards clarifying my understanding of the semantics of the class flag.

Do you think that use case make sense, and is it something you'd be willing to merge?

It's fine if you don't think this is mergeable, and I don't want to open nuisance PRs in the future.

@sol
Copy link
Owner

sol commented Nov 11, 2025

Do you think that use case make sense, and is it something you'd be willing to merge?

If feasible without implementing a full markdown parser, and if it doesn't get too messy, then technically it's within the scope of the project.

Indented code blocks have to be proceeded by an empty line (or be at the beginning of the document) and be indented by four spaces.

However, this alone is not enough to decide what to extract.

For example:

  - foo

    bar

Here

    bar
  • is proceeded by an empty line
  • Is indented by four spaces

but it is part of the list item, not an indented code block.

@wolverian
Copy link
Author

Yep, the existing test for delimited code blocks indented under a list item made that clear 🙂 I'm sure it will be a pain if possible at all.

Why not go for a full markdown parser by the way?

@sol
Copy link
Owner

sol commented Nov 11, 2025

I was about to say:

If you really want this, then I think it should be easy to implement it e.g. using pandoc. But, to keep the dependency footprint of markdown-unlit minimal, this would be more suitable for a separate package.

But then I realized that I actually did this in the past: https://hackage.haskell.org/package/pandoc-unlit

I'm not sure if it still compiles, but you could use it as a starting point for a new package, e.g. unlit-indented-markdown.

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.

2 participants