[Feature]: Allow markdown file uploads in the assets folder?
What area(s) will this request affect?
Theme
What type of change do you want to see?
New feature
Overview
While older versions of the Shopify theme CLI allowed markdown files to be added to the theme assets folder, the current version encodes them so they're unusable. We'd really love those files to not be encoded or changed in any way so we can use them within our themes.
Motivation
Our use case is that we want to keep .md documentation files within local theme files, and showcase those on internal-use themes. We're setting up an internal-use dev store that will be referenced by our entire agency and all devs, to act as a single source of truth for everything we create at a theme level, and being able to display .md documentation alongside that would be critical.
Part of why we're creating a dev store to do this is that we can have live previews of sections. Other documentation sites wouldn't be able to support this, and we don't want to get into the weeds of a highly complex, third party integration setup - and would prefer to keep everything on Shopify.
I realize we could upload .md files to Content/Files, but at that point, we'd be breaking the local file connection, which is critical for us. We need all theme assets and documentation to live in a single local (and Github-connected) folder.
Would love it if we could upload .md files to assets without running into encoding issues!
Hey @hannahbeasley! Sorry this slipped through the cracks. I think this might have actually already been addressed. I just tested this on both 3.75.0 and 3.76.2 and ran shopify theme pull and successfully pulled markdown files in the assets folder.
I'm going to close the issue for now but if you're still experiencing this please re-open the issue. In your reply if you could provide a Request ID and/or a copy of the markdown file (if okay to be posted publicly) that you're having a problem with. Thanks!
@graygilmore No problem at all!! Thanks so much for the reply! I just tested again (using the most up to date version of the CLI) and what's weird is that when I originally previewed my setup (where I'm using zero-md to render my md files via the md asset url) I could correctly see the MD file - but as soon as I edited the file, I just saw the encoded version instead of the correctly rendered file. What's interesting is that once I pushed my updates to my Github-connected theme and viewed a preview of that theme within Shopify, the md file was correctly rendered. So it seems like md files (at least when used with zero-md) aren't working in development themes, but are working when pushed to published or unpublished themes.
For reference, the md file is here. I can't share a preview of the theme itself but here are two screenshots - the one of the rendered md file is from the live theme, and the one of the encoded md file is from a development theme.
where I'm using zero-md to render my md files via the md asset url
Can you explain this a little further? Depending on the size of the asset it can be encoded on our end for storage purposes. The URLs that we get through the GraphQL API should not be used to render the file at but rather used to download the file to your local system.
@graygilmore absolutely!! So zero-md simply takes an asset URL and renders that source. The code I'm using is this:
<zero-md src="{{ markdown_file_name | asset_url }}"></zero-md>
Further documentation on that setup can be found here! But what that script is doing is just dependent on having a non-encoded MD file that it can parse.
I'm noticing that the it seems like the development theme always pulls from this URL (encoded file):
While the live theme pulls fro this URL (non encoded file):
So does that mean that MD files are only encoded when used on dev themes?
I'll pull this in for the team to look at but considering the use-case it might not be as highly prioritized. Definitely something for us to keep in mind, though, thanks for the report!
This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
P.S. You can learn more about why we stale issues here.
This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
P.S. You can learn more about why we stale issues here.
Still relevant!
This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
P.S. You can learn more about why we stale issues here.
This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.
P.S. You can learn more about why we stale issues here.