Skip to content

Support pug templates in markdown as a "tagged template literal" #1114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shafdog opened this issue Mar 20, 2024 · 3 comments
Closed

Support pug templates in markdown as a "tagged template literal" #1114

shafdog opened this issue Mar 20, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@shafdog
Copy link

shafdog commented Mar 20, 2024

Framework provides some helpful CSS for .card and .grid – which do fill in some gaps in Markdown. But using HTML does not help in reading what is still Markdown. i.e. XML is never going to be "pretty", but a lot going on in Framework's .md file already (data loaders, built-in templates, etc.).

I've used pug (well, jade) a bit in the early node days, and always liked the syntax. And thought it's indented structure might be better to "soften" any HTML needs within the markdown & seemed possible with the "fenced code blocks" syntax.

```pug
  .grid.grid-cols-2
    .card
      h1 Card 1
      | Column 1
    .card
      h1 Card 2
      | Column 2
``` //

I did look into Framework's code to see about adding ```pug myself. And may still. But in spelunking the source, while possible, the "tagged template literals" support had a few tentacles across the code. I suppose using a data loader with #!.../pug and including that in .md would also workaround the issue, but that seemed kinda wonky.

So filing this report since ability to extend the supported "tagged template literals" seems generally useful. Whether pug is good approach IDK ... but Markdown does not do a common grid-like pattern well & HTML tags really clutter up the Framework's Markdown.

The fenced ```js is really nice concept! So basically I'd rather add some custom "tagged template" code, to avoid needing inline HTML in more cases.

@shafdog shafdog added the enhancement New feature or request label Mar 20, 2024
@mbostock
Copy link
Member

Related #967.

@shafdog
Copy link
Author

shafdog commented Mar 20, 2024

Yup #967 would solve my issue here.

Some option in observablehq.config.ts similar to "interpreters" make sense to me.
But any registration mechanism for adding new "code tag" into getLiveSource(), without forking, be welcomed.

@mbostock
Copy link
Member

Thanks @shafdog. Folding into #967 then, and we’ll work on making getLiveSource extensible via the project config.

@mbostock mbostock closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants