Preserve line breaks, to support importing Markdown format

Created on 2 July 2024, 3 months ago
Updated 15 July 2024, 2 months ago

Problem/Motivation

I am importing Markdown content with the Migrate and Migrate Plus module, and the line breaks are stripped during import, so lists break down ... It also prevents separating sections of text. My work-around is to insert an extra line break for each line, which is not ideal.

I am using the Markdown Easy β†’ module for Markdown support in CKEditor. This issue might also belong in Migrate Plus or Markdown Easy issue queue?

Here's the migration, if I don't have the extra line breaks, the text is put on the same line, and the Markdown breaks down.

id: sub_nodes
label: Subject migration, based on github.com/dinarcon/ud_migrations
source:
  plugin: embedded_data
  data_rows:
    -
      nid: 7086
      title: 'How to use Drupal'
      body: 'You can use Drupal for web site building.
      Here are some benefits (this list works):

      - Open source

      - Big community

      - A third reason

      Here are some benefits (end up on the same line ...):

      - Open source
      - Big community
      - A third reason

      So as you can see, there are many reasons to use Drupal'
  ids:
    nid:
      type: integer
process:
  nid: nid
  title: title
  body/value: body
  body/format:
    plugin: default_value
    default_value: markdown

destination:
  plugin: entity:node
  default_bundle: article
migration_dependencies:
  optional: []

The result in the CKEditor. Note also how the two first lines ("You can use..." and "Here are some") end up in the same line:

You can use Drupal for web site building. Here are some benefits (this list works):
- Open source
- Big community
- A third reason
Here are some benefits (end up on the same line ...):
- Open source - Big community - A third reason
So as you can see, there are many reasons to use Drupal

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
MigrationΒ  β†’

Last updated 1 minute ago

Created by

πŸ‡©πŸ‡°Denmark ressa Copenhagen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024