Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Parsing error for textarea that contains markdown source code #102

Open
stochastical opened this issue Jan 22, 2025 · 2 comments
Open

Comments

@stochastical
Copy link

Given the following template:

name: New Blog Post
description: Create a new blog post for your Hugo site.
title: "[New Blog Post] <title>"
labels:
  - new-blog-post
body:
  - type: input
    id: title
    attributes:
      label: Blog Post Title
      description: The title of the blog post.
    validations:
      required: true
  - type: input
    id: date
    attributes:
      label: Post Date
      description: Date of the blog post in YYYY-MM-DD format.
      placeholder: "2025-01-01"
    validations:
      required: true
  - type: textarea
    id: description
    attributes:
      label: Description
      description: A short description of the blog post.
    validations:
      required: true
  - type: input
    id: link
    attributes:
      label: Link
      description: The external link.
      placeholder: "https://www.youtube.com/embed/example"
    validations:
      required: false
  - type: textarea
    id: content
    attributes:
      label: Additional Content
      description: Add the content for the blog post.
    validations:
      required: false

and the following example Issue:

### Blog Post Title

Test blog post via `Actions`!

### Post Date

2025-01-01

### Description

This is a test to see if I can create new blog posts via a GitHub Issue Template!

### Link

None

### Additional Content

Testing that I can include ==Markdown== **here**!

And I get a nice editor on [GitHub.com](github.com)!! With a GFM Preview!

# Header 1

Header 1 content that should be in the `content` field

## Header 2

Header 2 content that should be in the `content` field

- [ ] Example todo

### Header 3

Header 3 content that should be in the `content` field

the parsed JSON looks like

{
    "title": "Test blog post via `Actions`!",
    "date": "2025-01-01",
    "description": "This is a test to see if I can create new blog posts via a GitHub Issue Template!",
    "content": "Testing that I can include ==Markdown== **here**!\n\nAnd I get a nice editor on [GitHub.com](github.com)!! With a GFM Preview!\n\n# Header 1\n\nHeader 1 content that should be in the `content` field\n\n## Header 2\n\nHeader 2 content that should be in the `content` field\n- [ ] Example todo",
    "header_3": "Header 3 content that should be in the `content` field"
}

we can see it's

  1. Missing the link field
  2. Created a new header_3 field instead of preserving it inside of content

That is, the expected output should be:

{
    "title": "Test blog post via `Actions`!",
    "date": "2025-01-01",
    "description": "This is a test to see if I can create new blog posts via a GitHub Issue Template!",
    "link":'',
    "content": "Testing that I can include ==Markdown== **here**!\n\nAnd I get a nice editor on [GitHub.com](github.com)!! With a GFM Preview!\n\n# Header 1\n\nHeader 1 content that should be in the `content` field\n\n## Header 2\n\nHeader 2 content that should be in the `content` field\n- [ ] Example todo\n\n### Header 3\n\nHeader 3 content that should be in the `content` field",
}
@ncalteen
Copy link
Contributor

I didn't think to account for markdown being included in a response, so I can can definitely see where this is going wrong there. I will make some tweaks to handle that :)

The only issue I see coming up is the header_3 field example. In that case, I will need to ignore any "fields" that are not in the issue form template, and join them with the preceding, valid field.

@ncalteen
Copy link
Contributor

BTW I love the idea of using issue forms to generate blog posts. If you ever decide to open source that project, I'd love to share it! I'm working on some documentation around IssueOps, and it would make a cool use case :)

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

No branches or pull requests

2 participants