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

Support user defined javascript and remark configuration #48

Merged
merged 3 commits into from
Sep 11, 2017

Conversation

mlouhivu
Copy link
Contributor

Added support for custom remark configuration options and for adding user defined javascript before remark.create() is called, e.g. to add custom remark macros.

Used similar approach as with user defined CSS, so javascript / configuration options are read from files with the same base as the markdown content:

  • talk.md
  • talk.css
  • talk.js (new file for javascript)
  • talk.config (new file for configuration options)

In addition, to fix mangling of e.g. quotation marks in user defined CSS, added Markup() to disable autoescaping of the CSS file content.

Include user-defined javascript before calling remark.create() to
support e.g. custom remark macros.
Allow adding lines of custom configuration for the rendering engine.
@bast
Copy link
Owner

bast commented Aug 15, 2017

Awesome! Thank you! I will review it ASAP and give feedback. I was in fact considering adding support for custom JS but I have hesitated for security reasons since then one can ship basically any JS code to the readers. We need to carefully check whether this can be a problem.

@mlouhivu
Copy link
Contributor Author

True. If only rendering your own content, it should be okay, but you are right that it allows one to include any javascript code.

Maybe one should give the reader the option to enable/disable it when rendering non-local files?

@bast
Copy link
Owner

bast commented Aug 15, 2017

I agree that for local files it should be fine. I need to think a bit about remote files. Arbitrary JS code is then possible. I wonder whether one could do harm even though there is https://en.wikipedia.org/wiki/Same-origin_policy. If we allow any JS we give people the possibility to serve any JS code behind cicero.xyz. I need to sleep on it but feel that this could become problematic.

@bast
Copy link
Owner

bast commented Sep 11, 2017

Sorry for the very late feedback. I will now integrate your changes but for the moment will disable the JS import for remote serving. I need to be sure that there is no risk before enabling it and currently I am not sure. But your changes are too good to stall them longer.

@bast bast merged commit ce691ea into bast:master Sep 11, 2017
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

Successfully merging this pull request may close these issues.

2 participants