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

tagName mapping options #26

Open
azu opened this issue Apr 8, 2023 · 0 comments
Open

tagName mapping options #26

azu opened this issue Apr 8, 2023 · 0 comments
Labels
help wanted Extra attention is needed Status: Proposal Request for comments

Comments

@azu
Copy link
Member

azu commented Apr 8, 2023

export const tagNameToType = {
"p": "Paragraph",
"ul": "List",
"ol": "List",
"li": "ListItem",
"q": "BlockQuote",
"blockquote": "BlockQuote",
"code": "CodeBlock",
"hr": "horizontalRule",
"br": "break",
"em": "Emphasis",
"strong": "Strong",
"a": "Link",
"img": "Image",
"h1": "Header",
"h2": "Header",
"h3": "Header",
"h4": "Header",
"h5": "Header",
"h6": "Header",
} as const;

Currently, tagName mapping is hardcode.
However some use cases force change the mapping.

For example, a user want to treat div as p.
Of course, the user can create custom plugin.
But, it is easy to add new option than creat a fork.

{
   "plugins": {
       "html": {
           "tagNames": {
             // new mapping
             "div": "Paragraph"
           }
       }
   }
}

This option is a bit inflexible and we need to consider options that can satisfy a more varied set of use cases.

📝 textlintrc is JSON. So, we can not write JS Code as logics in option.

@azu azu added help wanted Extra attention is needed Status: Proposal Request for comments labels Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed Status: Proposal Request for comments
Projects
None yet
Development

No branches or pull requests

1 participant