eleventy icon indicating copy to clipboard operation
eleventy copied to clipboard

Can Eleventy support code snippet import in Markdown?

Open nweldev opened this issue 4 years ago • 1 comments

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.

nweldev avatar Jul 14 '20 22:07 nweldev