Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Fix markdown preview HTML file save with fenced code blocks. #567

Closed
wants to merge 2 commits into from

Conversation

bdaehlie
Copy link

@bdaehlie bdaehlie commented Jul 10, 2019

Description of the Change

Fixes issue #552, which is about markdown preview silently failing to "Save As..." when the markdown contains plain text fenced code blocks.

The patch here simply stops attempting to tokenize plain text fenced code blocks for syntax highlighting. It isn't necessary anyway.

You can read about the development of this patch in this comment:

#552 (comment)

This explains the code paths taken, and ultimately what the problem is (an unfulfilled promise when attempting to tokenize plain text).

Alternate Designs

A possible alternative fix might consider why no onDidTokenize callback happens when attempting to tokenize plain text. I don't believe the effects of such a fix would be any different than this patch, as there is no point in attempting to tokenize a plain text block.

Benefits

Issue #552 is fixed. Plain text (no language) fenced code blocks no longer cause file saves to fail.

Possible Drawbacks

None that I'm aware of.

Applicable Issues

Issue 552

@rsese
Copy link

rsese commented Jul 16, 2019

Thanks @bdaehlie! The team will need tests to be added before they can review, and tests will also help guard against future changes breaking your work 😄 If you need any help, there are a bunch of helpful community members on the Atom Slack team that should be willing to point you in the right direction.

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

Successfully merging this pull request may close these issues.

2 participants