notslang / tidy-markdown

Beautify Markdown, fixing formatting mistakes and standardizing syntax
https://npmjs.com/package/tidy-markdown
GNU General Public License v3.0
75 stars 11 forks source link

tags with additional attributes are converted to markdown #28

Open notslang opened 8 years ago

notslang commented 8 years ago

moved from https://github.com/slang800/atom-tidy-markdown/issues/44 by @superbest

I noticed that <img> tags seem to be corrected too aggressively.

I have several files where I include images with something like <img src="my image.png" width=500> because the image itself is too large for a nice layout. Tidy Markdown converts these into ![](my image.png). This strips the width information, and disrupts layout.

Possible solutions (pick one:

  • Leave HTML tags alone and don't tidy them at all.
  • Don't tidy <img> tags.
  • Check the tag and only tidy if there are no properties besides src.
  • Make HTML tag tidying optional behavior.
notslang commented 8 years ago

I think that adding an option like --no-aggressive-html-conversion (or a better name if someone can come up with one) would be a good idea... That option would make sure that any HTML which cannot be fully represented by Markdown isn't converted.

However, I think that, by default, we should strip attributes like that... It's quite useful when taking a webpage and rewriting it in Markdown and usually attributes like width should be handled by CSS.

arranf commented 8 years ago

I just want to throw in I think the default should be the other way around. Your average user isn't expecting to encounter reduced markdown when they use the plugin but someone who's transforming pages from HTML to MD is likely to investigate further.

matthewfeickert commented 7 years ago

So was there any resolution on this, or is this still an issue that someone has yet to take on?