-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
ENH: custom markdown processor #234
Comments
I’m sure it’s possible, but would require some code changes to do it. Someone contributed some preliminary support for rst via an external mechanism. It would probably be valuable to others to generalize this somehow. Not sure what makes sense here. Hugo is already written in such a way to add support for a bunch of different formats, but the only processor go has that I could find was markdown. Best, -- From: Spencer Lyon [email protected] I love how easy Hugo makes it to organize and display my content. I am used to using pandoc to convert my markdown to various formats and would love to use it within Hugo. Is there any way we could shell out to a custom markdown processor within Hugo? I realize that this might defeat a lot of the speed gains we get by using Hugo, but it would also add some flexibility for those who are willing to sacrifice a little performance. — |
I don't think it'd be sacrificing performance so much -- the input could be cached. I've been using pandoc to convert old content to markdown for hugo use (though not deployed yet; there were some bugs in pandoc dealing with some of my textile content). We could cache the pandoc output and only re-generate it if the source changes. It's a bit ugly but there's a lot done in pandoc that I don't see anyone having enough interest to re-implement in Go. |
It would be great to see Pandoc (and others) supported in Hugo! |
This would be fantastic; I think it's worth pointing out that markdown isn't any one Markdown^TM - there must be hundreds of variations that build on the basic Gruber syntax. Pandoc is probably the most versatile (?) implementation in both the senses that 'pandoc markdown' permits a larger syntax (code, tables, amsmath) than anything else I've seen - but also that it's completely customisable. You can start with Anything else isn't saying so much "you can create content in markdown" as it is "you can create content in this markdown". I think a really nice solution would be to have a config file something like: [renderers]
mymarkdown = pandoc --options
latex = pandoc --different-options
myownlanguage = sometooliwrote and then being able to run |
Also in Pandoc's favour - the workaround for using Wrap my |
👍 |
It's a pity that hugo needs workaround on handling math blocks. If hugo can't handle this properly, at least there's could be a switch that disable |
So it is no easy way to add pandoc? could you point out where have to make the changes? because it seems that the only solution to use heavy math is by using pandoc. |
Add the configuration variable externalFormats, which maps formats to a custom external executable or list of an executable and arguments. Shell out to these executables to render content of those formats. Fixes gohugoio#234.
Add the configuration variable externalFormats, which maps formats to a custom external executable and arguments, as either a string parsed as whitespace-separated tokens or a list. Shell out to these executables to render content of those formats. Fixes gohugoio#234.
Add the configuration variable externalFormats, which maps formats to a custom external executable and arguments, as either a string parsed as whitespace-separated tokens or a list. Shell out to these executables to render content of those formats. Fixes gohugoio#234.
Seems that #4060 is about to fix this issue in 'a couple of days'. |
I don't remember exactly because I switched to Jekyll, but I guess that this markdown is a good example https://github.com/lsaravia/MultifractalsInR/blob/master/Curso3.md |
@lsaravia Thanks! That example post worked just fine with my flow :) Org source -> Exported Hugo-compatible Markdown -> Hugo generated HTML |
mmmm is not working very well, the symbol (R) should not be in the equations :( |
@kaushalmodi Heres an example of rich math content: Neural Network Notes Actually I solved this by forking a copy of blackfriday and add MathJax support to it. Commit And corresponding patch to Hugo is Here Now it work well for me. |
@lsaravia Well the smartypants Blackfriday extension is over smart (russross/blackfriday#411). I should be able to put a hack in ox-hugo to outsmart that. @Vonng You seem to be a serious Go coder (I haven't yet coded in Go). Have you considered submitting a PR for better MathJax support to Blackfriday? |
@lsaravia First of all, why wouldn't you use In any case, if you ever use Hugo again, that too, with The trick was simple (even if you don't understand elisp, the comment there should explain the trick), that now transforms the earlier exported (.. and a bonus test). Let me know if you still see issues in there. It's strange and wonderful, you helped fix a bug in something you don't even use :). Thank you. |
@kaushalmodi markdown feature won't effect in math block, so (x) (r) is ok in equations. |
Of course it should be OK (I had put a /sarcasm tag there :)). The problem is that Blackfriday infers the
I am aware of that, but I don't want to disable the whole of smartypants (it does a lot of things). I want to disable just smartParens component of smaryPants and only in equations. If you click the link I just referred, you'll see that there's no way to disable just smartParens.
Hugo does have an option to disable things that can be disabled (like SMARTYPANT_FRACTIONS, SMARTYPANTS_DASHES, etc. see Blackfriday Options in Hugo documentation) because Blackfriday has provided an API for that.. but nothing similar exists on the Blackfriday side to disable just smartParens. |
@kaushalmodi I don't like x-files so I never use x :), many people helped me selflessly so I try to contribute back... |
Thanks! That was a great example! I got to fix few more things while making that example work. The only hurdles I faced while porting your Markdown example to Org were:
That's all I needed after converting your Markdown to Org using pandoc. I believe that your example renders fine now.. see the Hugo generated HTML linked below. Org source -> Exported Hugo-compatible Markdown -> Hugo generated HTML Looking forward to comments :) |
Please use https://discourse.gohugo.io/ for discussions. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I love how easy Hugo makes it to organize and display my content.
I am used to using pandoc to convert my markdown to various formats and would love to use it within Hugo. Is there any way we could shell out to a custom markdown processor within Hugo?
I realize that this might defeat a lot of the speed gains we get by using Hugo, but it would also add some flexibility for those who are willing to sacrifice a little performance.
The text was updated successfully, but these errors were encountered: