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

Support for pre-fill forms on the ask page #1009

Closed
fenbox opened this issue Jul 5, 2024 · 8 comments
Closed

Support for pre-fill forms on the ask page #1009

fenbox opened this issue Jul 5, 2024 · 8 comments
Assignees
Labels
feature New feature request
Milestone

Comments

@fenbox
Copy link
Member

fenbox commented Jul 5, 2024

Is your feature request related to a problem? Please describe

As mentioned in #252, we need some pre-fill support when ask question.

Describe the solution you'd like

When visiting a link with a pre-fill parameter, the form content will be automatically filled.

Link: /questions/ask?prefill={{ markdown_parameter }}

{{ markdown_parameter }}:

---
title: hello world
tags: feature-request, template
---

Some body text...

Result:

image

@fenbox fenbox added the feature New feature request label Jul 5, 2024
@hgaol
Copy link
Member

hgaol commented Jul 7, 2024

Hi @fenbox , I'd like to try this task, thx! BTW, do we need the functionality of adding, updating, getting and deleting of a question template?

@fenbox
Copy link
Member Author

fenbox commented Jul 7, 2024

Hi @hgaol, the function of managing templates can be implemented by plugins in the future, which is not part of the core program.

@hgaol
Copy link
Member

hgaol commented Jul 8, 2024

Hi @fenbox and @shuashuai , how about using json format for {{ markdown_parameter }} and keep the same structure with draft in local storage. e.g.

{
  "tags": [],
  "title": "title",
  "content": "Hello World",
  ...
}

Cause I found it's not easy to parse markdown to get the metadata like tags, title. Pls let me know if any suggestion.

@shuashuai
Copy link
Member

Hi @fenbox and @shuashuai , how about using json format for {{ markdown_parameter }} and keep the same structure with draft in local storage. e.g.

{
  "tags": [],
  "title": "title",
  "content": "Hello World",
  ...
}

Cause I found it's not easy to parse markdown to get the metadata like tags, title. Pls let me know if any suggestion.

From a technical point of view, this is indeed the case. Using json is more intuitive and easier to parse.

@fenbox
Copy link
Member Author

fenbox commented Jul 11, 2024

I prefer markdown because markdown format will be more convenient for operators in non-technical industries to maintain, and there are already typical system cases.

  • There are two types of issue templates on GitHub: one is in markdown text format, and the other is in YAML configuration form.
  • The case of dev.to is markdown.

Note

In the tag section, only existing tags can be input. If a tag in template does not exist, it will not be displayed and not able to be added.

@shuashuai
Copy link
Member

I agree with the above point of view.

The case of dev.to is markdown.

I also prefer this solution

pr #1014 This solution simplifies the implementation of the technology, but it can be significantly more difficult for the user to use.

From a technical point of view, this is indeed the case. Using json is more intuitive and easier to parse.

I'm sorry, I wasn't thinking in terms of user usage.

@hgaol
Copy link
Member

hgaol commented Jul 11, 2024

Good point, sure, I'll update #1014 to use markdown format.

@hgaol
Copy link
Member

hgaol commented Jul 11, 2024

updated to support markdown format. It'll use title and tags metadata to pre-fill title and tags. But the content should be encoded (encodeURIComponent in js) before as a parameter to avoid special characters.

@fenbox fenbox added this to the v1.3.6 milestone Jul 22, 2024
@fenbox fenbox moved this from Todo to Review in Answer Roadmap Jul 22, 2024
@fenbox fenbox closed this as completed Jul 25, 2024
@github-project-automation github-project-automation bot moved this from Review to Done in Answer Roadmap Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
Archived in project
Development

No branches or pull requests

3 participants