11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
16.67k stars 484 forks source link

Can Eleventy support code snippet import in Markdown? #1315

Open nweldev opened 4 years ago

nweldev commented 4 years ago

Question

In markdown files, I extensively use the Vuepress "import code snippet" syntax, which allows importing some delimited part of a code file as a code snippet (see https://github.com/vuejs/vuepress/pull/2225).

>>> @/directory/myfile.js#region

FYI, I also made a Pandoc plugin for that, pandoc-import-code.

Would it be possible for me to write a similar plugin for eleventy?

Context

I'm looking to migrate one of my websites, fullweb.dev (sources here), from Vuepress to a more "flexible" approach.

Meaning:

A. using a static site generator (like eleventy) only for the actual static parts, written in markdown

Some of these markdown files are also used to generate some other formats (like .odt) via Pandoc.

So, I could simply use pandoc -F pandoc-import-code src/my-source-file.md -o dist/my-fragment.html to generate the HTML fragments, and then write the whole website myself, but I would like to give a try a more complete solution allowing me to do everything Vuepress already does (e.g. "dev server watch" mode and routing), and more. Inspired by https://github.com/open-wc/open-wc/pull/1594, I would like to give a try to Eleventy, even if I would like to avoid njk files as much as possible.

B. using VanillaJS/lit-html for the dynamic parts

For example, /inventory/:name.

Right now, It's a Vue SFC and requires some tricks for routing.

I'm new to Eleventy, so I welcome any comments and suggestions.

zachleat commented 2 weeks ago

Unfortunately this issue slipped under the radar—I’m finally circling back through some of the old issues on the tracker but I’d love a confirmation that this old one is still relevant before I start debugging! If I don’t hear anything in the next two weeks, I’ll likely close it as stale—sorry (and thank you!)