marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
7.78k stars 273 forks source link

Change md code-block style #1451

Open dmadisetti opened 5 months ago

dmadisetti commented 5 months ago

Description

Current codeblock style is ```{.python.marimo}

I think code blocks should:

Suggested solution

```python {marimo}

  • [x] syntax support in VScode out of the box (python does the trick)
  • [x] syntax support in github (yep)
  • [x] Have a loose check pattern (maybe just check for "{marimo}")
  • [ ] Register as a quarto execution block (this format breaks pandoc pretty bad)
  • [x] Enable args (e.g. python {marimo name="whatever"}
  • [x] Be pretty syntax (I like it!)

Alternative

Making an issue for comments, but maybe better changed to a discussion post? I'm think asking on discord and getting feedback if people are actually using markdown.

Additional context

@mscolnick suggestion!

dmadisetti commented 5 months ago

Others:

```{marimo} python

assert None == 123, "string"

```{python}

assert None == 123, "string"

```python .marimo (no good for pandoc)

assert None == 123, "string"

Other suggestions:

dmadisetti commented 5 months ago

Ok, just found this: https://github.com/jgm/pandoc/pull/8187

So these are fine

```python {.marimo}

assert None == 123, "string"

or ```python {#marimo}

assert None == 123, "string"

or ```python {marimo=}

assert None == 123, "string"

but still might be worth creating an issue for null attributes to make the ```python {marimo} syntax work

mscolnick commented 5 months ago

I think i like python {.marimo} the best (unless can get python {marimo})

dmadisetti commented 5 months ago

The fix in pandoc looks pretty trivial: https://github.com/jgm/pandoc/issues/9791

I think it's going to be a matter of will- but I think it's good functionality. Hopefully, I get a positive response

dmadisetti commented 4 months ago

One downside to this notation is that it breaks in marimo markdown itself (current renders no styling, but proposed does not render)

https://marimo.app/l/oaqlop


I might pick this up sooner than later with backwards compat in mind. As I'm working more directly with the notebooks (esp, with the kiosk mode picking up speed), the current notation is a little cumbersome

I don't think python {marimo} is happening anytime soon, so will put in python {.marimo}. @mscolnick if the SQL changes are coming up, I can make sure sql {.marimo} works too

mscolnick commented 4 months ago

amazing! i agree it would be worth doing sooner to avoid too much breakage. If backwards compat is hard, we can make a breaking change and bump acccordingly (probably could read backwords compat and then write forwards)

dmadisetti commented 4 months ago

Just checks to see if {.*python.*} is in the code block,

I think it should check for {.*marimo.*}. I think this will make it automatically backwards compatible?

dmadisetti commented 1 month ago

Will submit PR once https://github.com/facelessuser/pymdown-extensions/pull/2470 is released, conditional on version number