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

Add Support for Customizable Tab Handling in Markdown Code Blocks #3224

Open
ArfaNada opened this issue Mar 11, 2024 · 2 comments
Open

Add Support for Customizable Tab Handling in Markdown Code Blocks #3224

ArfaNada opened this issue Mar 11, 2024 · 2 comments

Comments

@ArfaNada
Copy link

ArfaNada commented Mar 11, 2024

Description

Marked.js currently lacks support for customizable tab handling within Markdown code blocks. This feature would allow users to specify tab width and customize tab behavior within code blocks, enhancing the flexibility and usability of Marked.js for Markdown parsing.

Why is this feature necessary?
The ability to customize tab handling is essential for users who work with Markdown documents containing code blocks. Different projects and coding styles may require varying tab widths and behaviors, and providing this customization option would improve the overall experience of using Marked.js for Markdown rendering.
@daniel-santos
@timabbott
@zulip (zulip/zulip#29044)

Proposal
I propose extending Marked.js to support the parsing of Markdown code blocks with customizable tab handling. This enhancement would involve adding functionality to interpret additional parameters within code blocks, such as specifying the tab width using a syntax like ts=.
Implementation Details
To implement this feature, the following steps could be taken:

  1. Extend the parser to recognize and interpret the ts= syntax within fenced code blocks.
  2. Implement logic to adjust the tab width based on the specified parameter .
  3. Ensure that the parsing of code blocks remains efficient and compatible with existing Markdown syntax.

Benefits
• Provides users with greater control over tab handling within code blocks, accommodating projects that still use tabs for indentation.
• Enhances the versatility and usability of Marked.js for a wider range of Markdown formatting requirements.

Alternatives Considered
Alternative solutions might include using external Markdown rendering libraries or manually processing Markdown documents to customize tab behavior. However, these approaches are less efficient and would require additional effort from users.

By adding support for customizable tab handling in Markdown code blocks, Marked.js can better align with established Markdown specifications and meet the diverse needs of its user base.

@UziTech
Copy link
Member

UziTech commented Mar 11, 2024

Marked.js can better align with established Markdown specifications and meet the diverse needs of its user base.

I'm curious which markdown specifications include this?

@timabbott
Copy link

I'm not aware of any; as I noted in zulip/zulip#29044 which seems to have inspired @ArfaNada to open this issue, my question there was whether there is any prior art for the original reporter's problem statement. So I think @ArfaNada might have been confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants