Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plain input format or similar method to escape Markdown #1721

Closed
nichtich opened this issue Oct 26, 2014 · 5 comments
Closed

Add plain input format or similar method to escape Markdown #1721

nichtich opened this issue Oct 26, 2014 · 5 comments

Comments

@nichtich
Copy link
Contributor

Related to issue #1685 I am looking for a method to convert a plain Unicode string to Pandoc Markdown. For instance:

echo '- \hello <world>' | pandoc -f plain -t json
[{"unMeta":{}},[{"t":"Para","c":[{"t":"Str","c":"\u002d"},{"t":"Space","c":[]},{"t":"Str","c":"\u005chello"},{"t":"Space","c":[]},{"t":"Str","c":"\u003cworld\u003e"}]}]]

and by this

echo '- \hello <world>' | pandoc -f plain -t markdown
\- \\hello \<world\>

in addition to

echo '- \hello <world>' | pandoc -t json
[{"unMeta":{}},[{"t":"BulletList","c":[[{"t":"Plain","c":[{"t":"RawInline","c":["tex","\\hello "]},{"t":"RawInline","c":["html","\u003cworld\u003e"]}]}]]}]]

By the way this seems to be a bug in the Markdown export:

echo '[{"unMeta":{}},[{"t":"Para","c":[{"t":"Str","c":"\u002d"}]}]]' | \
pandoc -f json -t markdown | pandoc -t json
[{"unMeta":{}},[{"t":"BulletList","c":[[]]}]]
@jgm
Copy link
Owner

jgm commented Oct 26, 2014

echo 'Str "hi*there*"' | pandoc -f native -t markdown
hi \*there\*

+++ Jakob Voss [Oct 26 14 02:55 ]:

Related to issue #168 I am looking for a method to convert a plain Unicode string to Pandoc Markdown. For instance:

echo '- \hello ' | pandoc -f plain -t json
[{"unMeta":{}},[{"t":"Para","c":[{"t":"Str","c":"\u002d"},{"t":"Space","c":[]},{"t":"Str","c":"\u005chello"},{"t":"Space","c":[]},{"t":"Str","c":"\u003cworld\u003e"}]}]]

and by this

echo '- \hello ' | pandoc -f plain -t markdown

  • \hello

in addition to

echo '- \hello ' | pandoc -t json
[{"unMeta":{}},[{"t":"BulletList","c":[[{"t":"Plain","c":[{"t":"RawInline","c":["tex","\hello "]},{"t":"RawInline","c":["html","\u003cworld\u003e"]}]}]]}]]

By the way this seems to be a bug in the Markdown export:

echo '[{"unMeta":{}},[{"t":"Para","c":[{"t":"Str","c":"\u002d"}]}]]' |
pandoc -f json -t markdown | pandoc -t json
[{"unMeta":{}},[{"t":"BulletList","c":[[]]}]]


Reply to this email directly or view it on GitHub:
#1721

@lierdakil
Copy link
Contributor

Yes, but writing in native format would require escaping backslashes and double quotes by hand, would it not?

@jgm
Copy link
Owner

jgm commented Oct 28, 2014

+++ Nikolay Yakimov [Oct 27 14 17:57 ]:

Yes, but writing in native format would require escaping backslashes and double quotes by hand, would it not?

Yes, though you can always write a little program to do this for you.

@mmirate
Copy link

mmirate commented Oct 29, 2014

Yes, the program in question is quite little indeed, fitting neatly on two lines:

main :: IO ()
main = putStr "Str " >> interact show

@mpickering
Copy link
Collaborator

I think @mmirate provides a good solution.

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

No branches or pull requests

5 participants