Skip to content

splitAST does not split sentences within link titles #25

@kimburgess

Description

@kimburgess

Closely related to #24—possibly more controversial.

When provided with an input of:

{
  type: 'Paragraph',
  children: [
    {
      type: 'Link',
      title: null,
      url: 'https://example.com',
      children: [Array],
      loc: [Object],
      range: [Array],
      raw: '[This link has more than one sentence. It has two lines.](https://example.com)'
    }
  ],
  loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 78 } },
  range: [ 0, 78 ],
  raw: '[This link has more than one sentence. It has two lines.](https://example.com)'
}

The following is returned:

{
  type: 'Paragraph',
  children: [
    {
      type: 'Sentence',
      raw: '[This link has more than one sentence. It has two lines.](https://example.com)',
      loc: [Object],
      range: [Array],
      children: [Array]
    }
  ],
  loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 78 } },
  range: [ 0, 78 ],
  raw: '[This link has more than one sentence. It has two lines.](https://example.com)'
}

However these are equivalent representations:

[This link has more than one sentence. It has two lines.](https://example.com)
[This link has more than one sentence.
It has two lines.](https://example.com)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions