Skip to content

Add option to disable pretty print through comments #131

@rohit-gohri

Description

@rohit-gohri

prettyprint

Description

I'm using marko in some weird ways like dynamically opening and closing ul tags in a for loop:

		<if (openCondition)>
			$!{'<ul>'}
		</if>
		<if (closeCondition)>
			$!{'</ul>'}
		</if>

This is pretty printed to:

		<if (openCondition)>
			<ul>
		</if>
		<if (closeCondition)>
			</ul>
		</if>

Which doesn't work because it throws an error:
The closing "ul" tag does not match the corresponding opening "if(openCondition)>

Why

This would help increase usage of pretty print as a standard linting option, as projects that are not being able to use it because of some edge cases can disable it in the code itself for that edge case.

Currently I would have to make a custom script around this module and maintain a list of files to be excluded.

Possible Implementation & Open Questions

I propose adding something akin to eslint's disable-line/disable-next-line/disable-file comments that will tell pretty print to not change the corresponding part of the template.

Is this something you're interested in working on?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions