Skip to content

Conversation

@trebor
Copy link
Contributor

@trebor trebor commented Jan 25, 2024

adds global and front-matter options to show fenced block source code. i am happy to change up the syntax, and/or semantics if folks have good alternatives, but here is what i have implemented. btw: i considered a boolean, but went with the "show" string to indicate the specific action. in observablehq.config.ts add:

  ...
  blocks: "show",
  ...

and in front-matter:

---
blocks: show
---

in both cases, values other than "show" will have no effect.

echo takes precedence over front-matter blocks, which takes precedence over observablehq.config.ts blocks.

hmmm...

as i look back at the issues, it may be this option was always intended to be called 'echo' in config and front-matter. which would make sense. let me know if i should switch over to that.

closes #156

@trebor trebor marked this pull request as draft January 25, 2024 22:21
@trebor trebor requested review from cinxmo and mbostock January 25, 2024 23:52
Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should be echo: false, but there are a couple other considerations, namely

  1. whether the echo option should be scoped under a execute object like Quarto execution options (though I don’t think I’d use the name execute) so we can have other options there too, namely run: false if you want to disable run by default and

  2. language-specific options (e.g., turning on echo for js, but turning it off for html). So maybe the scope should be js or html for language-specific options, and top-level for all languages, with suitable precedence.

@trebor
Copy link
Contributor Author

trebor commented Jan 26, 2024

i've not been able to come up with any great alternatives to an "execute". maybe 'construct'?

for echo the spec could take a boolean, or a list of language tags like:

echo: [js, html]

@mbostock
Copy link
Member

mbostock commented Jan 26, 2024

Sorry for not being clear. The alternative I was suggesting was to use the language. So,

js:
  echo: true

means turn on echo true by default for js blocks. Whereas

echo: true

means turn it on for all blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Page-level and global code block options

3 participants