mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-09 13:56:56 +00:00
[Question] Processing single quotes after SmartyPants #117
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cincuranet on GitHub (Jul 2, 2017).
I'm trying to convert all single quotes left after SmartyPants extension into
’(’), but I'm failing. Whenever I introduce someLiteralInlineintoprocessorwhile inMatchmethod, I erase everything what SmartyPants did. I think I need bit help where to properly plug the extension and how to match the char. Because so far all my attempts with myInlineParserfailed.This code:
returns
<p>“hello' test”</p>(with SmartyPants). So far so good. What I'd like to archieve is to get<p>“hello’ test”</p>(or<p>“hello’ test”</p>).Thanks for any kick in right direction.
@xoofx commented on GitHub (Jul 2, 2017):
Not sure that would be easy to do it outside the existing extensions that already process these characters. I would start to modify the code at
SmartyPantsInlineParser:L282to keep the characters you want based on the criteria you are expecting...@cincuranet commented on GitHub (Jul 3, 2017):
Hmm. SmartyPants is using
OpeningCharacterswhile my'can be anywhere (see my example). Your idea of directly changing the parser is good. I can disable then the balancing checking.@xoofx commented on GitHub (Jul 3, 2017):
The
OpeningCharactersis just used to indicate that the parser must be called for this character, but it can happen anywhere, that's fine. You just have to change slightly the behavior in the methodBlockOnProcessInlinesEndto better handle your case.@cincuranet commented on GitHub (Jul 11, 2017):
Finally somewhat hacked it together. There's not much changes at the end. Here's the diff (some whitespaces are fucked up, I know):
192b875055.Not sure whether it's too far from original SmartyPants idea or not and hence some PR would be worth.