Also you shouldn't rely on random secondary sources.
The double single quote is how you escape a single quote inside a single quoted string in YAML. It makes sense because the single quote itself is the only character which needs to be escaped inside a single quoted string, and it's unambiguous because two quoted strings after each other without anything between is a syntax error in YAML.
Thanks.
The `double single-quote` stuff is consistent to https://github.com/dotmaster/toYaml/issues/1
But it is a little complicated.
BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> I usually use a code span or code block in the metadata when I want it to stringify verbatim with ASCII quotes, dollars, square brackets etc.
> preserved. The stringification function should turn this into a plain string without any change to the Lua code. Note however that since the backtick is a
> reserved character in YAML you must enclose the code span in a single quoted string and double any single quotes inside the string:
>
> ````pandoc-markdown
> ---
> test: '`Children''s cognitive ability`'
> block: |
> ```
> Children's cognitive ability.
> Several.
> Lines.
> Of.
> Text.
> ```
> ---
> ````
>
> thus in your particular example the backslash escape may be preferable, but I definitely prefer the code span/block solution when there are many
> sensitive characters in the string. A lot of backslash escapes affect readability negatively, especially when you need to escape backslashes
> themselves. For some reason I find `` '`don''t`' `` more readable than `` don\'t ``, but YMMV.
>
> Den tors 16 maj 2019 09:41jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> skrev:
>
> I checked the manual, `smart` has effect on quotes and dashes.
> Instead of disabling smart, I have to escape it to minimize the effect.
>
> BTW, if it is for the title value
> ```
> ---
> title: Children's Cognitive Ability
> ---
> ```
>
> I get the expected result withouth escaping the quote or disabling smart:
>
> ```
> \title{Children's Cognitive Ability}
> ```
>
> Pandoc deals with it differently from a lua filter?
>
> John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>
> > YAML metadata fields are interpreted as markdown.
> >
> > You can escape it to prevent "smartification":
> >
> > Children\'s Cognitive Ability
> >
> > Or disable smartification globally by using `-f
> > markdown-smart` on the command line.
> >
> > jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
> >
> >> I have some meta value like
> >> ```
> >> ---
> >> test: Children's Cognitive Ability
> >> ---
> >> ```
> >>
> >> In my lua filter:
> >> ```
> >> function Meta(meta)
> >> for k, v in pairs(meta) do
> >> if k=='test' then
> >> print(pandoc.utils.stringify(v))
> >> end
> >> end
> >> end
> >> ```
> >>
> >> I find it prints
> >> ```
> >> Children’s Cognitive Ability
> >> ```
> >>
> >> I want to keep the single quote as it is. What should I do?
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> >> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> >> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2mujn7txr.fsf%40163.com.
> >> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2ftpe7sos.fsf%40163.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to pandoc-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m27eaq7pgx.fsf%40163.com.
For more options, visit https://groups.google.com/d/optout.