Anchor and UserAnchor nodes can contain children

The impetus for this change was to help make the MarkupConverter code
more robust. However, it's also possible that an Anchor can contain
styled text. For example, in markdown someone might write a link that
contains some <strong> text:

```markdown
[this link is so **good**](https://example.com)
```

This setup will now allow that. Unknown if UserAnchor can ever contain
any text that isn't just the user's name, but it's easy to deal with
and makes the typing much easier.
This commit is contained in:
Edward Loveall 2021-08-08 14:34:40 -04:00
parent 130b235a6c
commit 31f7d6956c
No known key found for this signature in database
GPG key ID: 789A4AE983AC8901
6 changed files with 19 additions and 18 deletions
spec/components

View file

@ -40,7 +40,7 @@ describe PageContent do
it "renders an anchor" do
page = Page.new(nodes: [
Anchor.new(href: "https://example.com", text: "link"),
Anchor.new(children: [Text.new("link")] of Child, href: "https://example.com"),
] of Child)
html = PageContent.new(page: page).render_to_string
@ -229,7 +229,7 @@ describe PageContent do
it "renders a user anchor" do
page = Page.new(nodes: [
UserAnchor.new(userId: "abc123", text: "Some User"),
UserAnchor.new(children: [Text.new("Some User")] of Child, userId: "abc123"),
] of Child)
html = PageContent.new(page: page).render_to_string