Questions tagged [marko]

An HTML-based templating engine that compiles templates to Node.js-compatible JavaScript modules and supports streaming, async rendering and custom tags.

Marko is a fast and lightweight HTML-based templating engine that compiles templates to CommonJS modules and supports streaming, async rendering and custom tags.

Learn more on http://markojs.com/.

64 questions
1
vote
1 answer

Is it secure to give the user option to edit Marko template?

I want to make the marko template editable by clients. I know that user can add scripts, and XSS issue. The question is about server side. If I run marko template from nodejs, and the template came from one user. Is it possible that the template…
Aminadav Glickshtein
  • 23,232
  • 12
  • 77
  • 117
1
vote
1 answer

Marko and Koajs: Why is my async-fragment rendering not working?

I'm trying to get progressive rendering to work in Marko and Koajs. First, I use the request-promise module to make a promise for a JSON data feed. rp = require('request-promise') function getDataFeed() { var url =…
Dev
  • 103
  • 1
  • 7
1
vote
1 answer

JS Marko (raptor templates) load dynamic template path in browser

I am trying to use Marko templates in a web application, and would prefer to be able to load pre-compiled templates dynamically. My (weak) understanding is that the suggested raptor-optimizer does static analysis to load all of the templates (as…
Eli Stevens
  • 1,447
  • 1
  • 12
  • 21
0
votes
1 answer

Marko in expressjs throwing not a function error

Hi I ran this example on my machine and it says markoExpress() is not a function. Any ideas ? This is example from https://markojs.com/docs/express/ require("@marko/compiler/register"); // Allow Node.js to require and load `.marko` files var…
0
votes
2 answers

multiple promises in Marko

In Marko, how can one multiple promises in parallel? For example, I am looking for something like this: <@then|result1, result2|> promise1 and promise2 are resolved in parallel ${result1} renders…
0
votes
1 answer

How can I dynamically create HTML components in Marko?

I want to create new Marko components every time the user clicks a button — by calling something like the JavaScript DOM method document.createElement("tag"). How can I do this in Marko, not just with ordinary HTML tags, but with custom Marko…
0
votes
1 answer

Prepend a url to all relative image links in a markdown document

I have a bunch of markdown documents with a mix of relative and absolute image destinations. e.g. This is some text ![optional caption](/sub/folder/image.png) And more text ![](https://example.com/cool_image.png) I want to prepend a URL to each…
Sixhobbits
  • 1,508
  • 3
  • 17
  • 26
0
votes
1 answer

MarkoTag not valid

I have a java application which is serving up a react ts app on the client side. I want to integrate marko into my application in order to access some marko components. I'm trying to follow a guide on how to add marko to my webpack config but all my…
mdave16
  • 177
  • 1
  • 11
0
votes
1 answer

How to pass object to components in marko?

Hello I am trying to call a component with an object as parameter but the component prints the object as string "[object Object]". In the docs it specify object as an attribute type: https://marko-v4.github.io/docs/marko-json/
Jeremy
  • 79
  • 1
  • 6
0
votes
3 answers

HTTPS node server doesn't return web pages

So I have just turned my HTTP web application to HTTPS. So my server.js currently looks like const https = require('https'); const fs = require('fs'); const options = { key: fs.readFileSync('key.pem'), cert:…
Edward Muldrew
  • 253
  • 1
  • 6
  • 20
0
votes
1 answer

How to pass an Event Listener as a Dynamic Attribute in Marko?

I'm trying to create a form in Marko and for the inputs I'm using a component that will create the inputs and will handle the validation. The hole problem is when I try to pass an event listener as a dynamic attribute. I have an array of fields as…
0
votes
1 answer

Google Cloud Functions doesn't load file directory correctly

I'm building a little function that sends mails through Google Cloud Functions. For templating i'm using Marko.js. When i do a require to a folder, returns a strange require with some numbers on path that doesnt exist on my local development. Do you…
0
votes
1 answer

cannot babel transform .marko files with webpack 4

i have a working marko setup for my widget. Im using webpack 4 and babel 7. When i add babel-loader to .marko files, the webpack compiler throws because it couldn't recognize marko's syntax as valid javascript. However the loader should work after…
TheDomis4
  • 122
  • 1
  • 13
0
votes
1 answer

How to send an object to .marko template and render its properties dynamically, in a table

Im doing some homework here. Build a server that handles a requisition to list all registers from a database, dynamically. Im using node js and the modules: express, marko and sqlite3. The db is set and has some registers for testing; (id, name,…
0
votes
1 answer

Repeatable attribute tags in markojs

I want a custom tag for tabs that will give me the possibility to write following code app-tabset#my-tab @tab title="first" p -- content of first tab @tab title="second" p -- content of second tab but I can't get it to consume repeated…
J.G.Sebring
  • 5,934
  • 1
  • 31
  • 42