Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Add pandoc as alternative to roaster #27

Closed
wants to merge 8 commits into from
Closed

Add pandoc as alternative to roaster #27

wants to merge 8 commits into from

Conversation

leipert
Copy link
Contributor

@leipert leipert commented Mar 8, 2015

TODO-LIST:

  • Implement pandoc functionality
    • Make pandoc path configurable
    • Make pandoc markdown flavour configurable
    • Toggle pandoc functionality
    • Give possibility to add own command line arguments
  • Check if all current functionality works
  • Add stress document
  • Cleanup & comment code
  • Add Documentation for Pandoc

Fixes #2, #11, #24, #17, #18 and #20

Original Message:

Hey @Galadirith. I know, this may come surprising and I also know there is lierdakil/markdown-preview-pandoc.
But as far as I am concerned the math there with --webtex looks meh.

Is there any way to establish pandoc as an optional renderer?
I added basic pandoc rendering, but it is impossible for me to get the math rendered in the preview pane.
Could you give me any hints?

@Galadirith
Copy link
Collaborator

@leipert Thats awesome to try to get pandoc working with the package, I would be glad to give you some help if I can. So the output of Galadirith/roaster with math enabled is quite specific, and there may be differences with how pandoc outputs parsed maths blocks.

So what I would suggest is to take a small markdown document with one or two math blocks and dump the output from both the pandoc renderer and the roaster renderer. I think perhaps the easiest way would be to add a console.log(html) just above lib/markdown-preview-view.coffee#L189 and then copy the output from atoms dev tools console. Feel free to send me the results, perhaps as a gist.

I steered clear of using pandoc originally, because it does require installation outside of atom (it can't be added as a node dependency) so I can't promise that I'll be able to merge in your fork, but I would be glad to help you get it working and then I can review everything then :D

Let me apologise in advance, I will be (mostly) unreachable over the next 2 weeks but if you have any questions or thought please post them and I'll get back to you as soon as I can :D Thanks again @leipert

@leipert
Copy link
Contributor Author

leipert commented Mar 9, 2015

I was able to get it to work !!!

pandoc --mathjax converts

  1. inline math $x$ to <span class='math'>\(x\)</span>
  2. math paragraphs $$x$$ to <span class='math'>\[x\]</span>

I added a function to the HTML sanitize function which will convert

  1. to <span class='math'><script type='math/tex'>x</script></span>
  2. to <span class='math'><script type='math/tex; mode=display'>x</script></span>

The pandoc variant fixes actually the following issues:

Only drawback I found so far, it does not render inline math with spaces $ E=mc^2 $, but everything works fine if there are none:$E=mc^2$

Furthermore I see the following improvements:

  • People can choose their own markdown subset they want to use. (see at Pandoc Manual)
  • This solution does not rely on patched roaster and marked packages.

Well and here a short ping @szhorvat as he seems to be interested in the package.

@leipert
Copy link
Contributor Author

leipert commented Mar 9, 2015

Well as I am procrastinating doing things for my bachelor thesis I prepared a comparison image of the current support on the left hand side and the support with pandoc on the right hand.

comparison

I am amazed :)

@leipert leipert changed the title [WIP] Implement possibility to use pandoc as alternative to roaster Add pandoc as alternative to roaster Apr 4, 2015
@leipert
Copy link
Contributor Author

leipert commented Apr 4, 2015

@Galadirith - just a ping, are you back yet?

@mangecoeur
Copy link

+1 for this :)

@Galadirith
Copy link
Collaborator

@leipert I'm really sorry for my long absence.

So this is just supper impressive :D I would really love to me able to merge this, it definitely seems that pandoc is just more mature and stable (which is no suprise :D) and actually my reservations of installing it on Windows, well theres an .msi so its not difficult :D

I'm afraid I am not going to be able to get round to merging this anytime before June 15th, and @KCErb has been working on adding Macro support for a long time in Galadirith/markdown-preview-plus#14 and I belive its only fair that I get his work merged in first.

But thank you for all your hard work on this, its looking fantastic and it will be exciting to get you code into the package :D

I won't be around much before June 15th, but please do feel free to ping me with anything and if I can I will absolutely get back to you :D

@leipert
Copy link
Contributor Author

leipert commented May 11, 2015

@Galadirith Welcome back :)

The thing is, that the pandoc support is optional, so it won't affect #14.
Furthermore I think that pandoc support would improve the usability a lot.

If you are not around that much, maybe you should consider adding more maintainers to the project (I would volunteer).
I really would like to see my code to production and would not like to fork the project, as there are enough markdown previews for atom already.

@leipert leipert closed this Jun 11, 2015
@leipert leipert deleted the master branch June 11, 2015 12:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LaTeX with $$ math $$
3 participants