md2cf icon indicating copy to clipboard operation
md2cf copied to clipboard

Fix bug where single newlines are included in Confluence page

Open bjorns opened this issue 3 years ago • 3 comments

Newlines would previously get propagated to the confluence page so my pretty 80 character wide readme files would look awful compared to single line paragraphs. This fix replaces newlines in text blocks with spaces so that paragraphs look right in the final confluence page.

bjorns avatar Jul 08 '22 14:07 bjorns

Hah, this is a good point and I'm a bit surprised that Mistune didn't already handle it when converting Markdown to HTML. Let me do some thinking for a couple of corner cases and I'll come back to this!

iamjackg avatar Jul 09 '22 01:07 iamjackg

Hey, I took a look and I'm a bit confused -- I tried uploading the sample document from the tests without your change, and it renders perfectly fine for me: all newlines are replaced with spaces when rendering HTML, and Confluence is no different in this regard.

Example image: image

Can you give me more details about what you're seeing?

iamjackg avatar Jul 27 '22 12:07 iamjackg

Sure, so we're using the Atlassian Cloud instance of Confluence, maybe that matters. Here's an example, for this input:

### Import standard modules
Standard modules are defined in [the modules directory](modules/). These are predefined pieces of
infrastructure that support standard architecture patterns or workflows.
These modules are versioned, and imports within deployments should reference a specific version to
prevent unexpected updates to your resource.
See [this example](https://github.com/UrbanCompass/application-infrastructure/blob/main/deployments/example/kafka/gamma/main.tf#L3)
on how to import a standard module. The import should look something like:

```
module "kafka_cluster" {
  source            = "git::[email protected]:UrbanCompass/application-infrastructure.git//modules/kafka-cluster?ref=v0.0.6-kafka-cluster"
  cluster_name      = "example"
  environment       = "gamma"
  team_id           = 72
  enable_monitoring = true
}
```

The source should follow this format `git::[email protected]:UrbanCompass/application-infrastructure.git//modules/[module-name]?ref=[version]-[modulename]`

Contributions to standard modules are welcome.

The current released version produces this output: Screen Shot 2022-08-05 at 14 05 44

After patch the output looks like this: Screen Shot 2022-08-05 at 14 11 50

bjorns avatar Aug 05 '22 18:08 bjorns

Huh, that's odd. Alright, in that case we should definitely add this, but behind a command line flag :) Would you be willing to add that to your PR?

iamjackg avatar Aug 19 '22 12:08 iamjackg

I'm adding this manually (and still crediting you) behind a command line flag. Thanks!

iamjackg avatar Aug 27 '22 01:08 iamjackg