WebView doesn't seem to register public.html contents on copy, only
Rich Text and Safari Web Archive. This results in format loss when
copy-pasting preview contents to browsers other than Safari, e.g.
Google Chrome (which takes Rich Text) and FireFox (plain text only).
Worked around by injecting public.html format when needed. Fix#115.
Hoedown does not clear renderer states before using it, so we shouldn't
reuse the renderer. The states are pretty internal, so we shouldn't
clear them ourselves, either.
Fix#111
When MathJax is on, delay window refreshing until it's done rendering.
This is implemented by adding a WebScripting object to the preview, and
register a MathJax signal handler that invokes the window refreshing
code via the WebScripting object.
This makes the editor not to go too wide when editing on a extremely
wide geometry (e.g. fullscreen with preview hidden), increasing
readibility.
Fix#108
-validateMenuItem: takes precedence over -validateUserInterfaceItem:
and would make the latter useless. Fixed by merging the former into
-validateUserInterfaceItem:.
Implemented by always turning underline extension on (which is the
ONLY way to distinguish _this_ and *this*) when MathJax is on, and
use a custom renderer callback with an extra HTML_* flag.
This is pretty hacky, but at least it works. Is it possible to
convice Hoedown to add functionality in substituting parsing
callbacks? Might worth a try, need to choose the word, though. :)
Fix#8
Only bare [TOC] (case insensitive) inside standalone <p> tag is
supported now. Don't know what the world would want; let's open
things when they are requested.
See #63
This implementation does NOT render TOC at a specific tag, but
just prepends the TOC portion in front of the content (but after
front-matter). The TOC syntax might be more difficult. Still
considering options.