Ask coding questions

← Back to all posts
How to choose which file displays when embedding?
rrcobb (0)

I have a repl with a Markdown readme - I want the readme to display when I embed the repl, instead of the default file.

Is there a way to configure this?

Commentshotnewtop
AdCharity (1329)

I mean here's a thought. Connect the project to github/commit the stuff and rename index.js as something else. Make the Markdown readme the first file so it will display first. Then, use a replit file and configure it to run the renamed index.js file.

rrcobb (0)

@AdCharity thanks for the reply! Quick clarification - what do you mean by 'first file'? I don't see a way of ordering the files in repl.it (or on github). As far as I can tell, it's alphabetical

AdCharity (1329)

@rrcobb problem is I have no clue (I'm pretty sure repl defaults to index -> alphabetical)

rrcobb (0)

@AdCharity okay, I haven't been able to get it work this way, but it might be there's no way to do it. Thanks anyway!

AdCharity (1329)

@rrcobb kk Give me an example project you want to send over I want to try that really quick (don't worry I'm not stealing your code)

rrcobb (0)

When I load the page, the .replit file opens - I want the README or index.js to open instead

SixBeeps (3221)

Repl.it will always run the main file, so how I'd do it is in your HTML page you want to embed the Repl into, put the readme there instead and make a new embed to the rest of the code whenever they're done reading it.

rrcobb (0)

@SixBeeps thanks for the idea!

It's actally a node.js repl, so it doesn't have an html page. I'm also using the .replit config file to decide what happens when I click the 'Run' button, and now that's the file that shows up when I embed the repl or refresh.

SixBeeps (3221)

@rrcobb Oh, interesting.
There's a library written in Node.js called Marked that parses markdown into the resulting webpage, so maybe give that a try?

rrcobb (0)

@SixBeeps I don't think that'll work for me - I mostly want to be able to configure which file shows up by default in the embed (instead of the .replit file)

SixBeeps (3221)

@rrcobb Oh yeah no that's not possible.