mfontanini / presenterm

A markdown terminal slideshow tool
https://mfontanini.github.io/presenterm/
BSD 2-Clause "Simplified" License
1.19k stars 29 forks source link

wip: need to render images within working directory #233

Closed chardskarth closed 5 months ago

chardskarth commented 5 months ago

I'm new to rust and I really like this project.

I'm trying to render images using typst so tempdir wont work in my usecase.

Upside of my PR:

Downside:

mfontanini commented 5 months ago

Does using

![]("imagehererelativetocurrentfile.png")

Not work? Or are you trying to use an image within typst somehow? I see the issue, I'm just curious of how you're using this..

chardskarth commented 5 months ago

This is what my slide currently looks like:

# Introduction on MBTI: 16 Personalities
<!-- new_lines: 2 -->
&nbsp;2 &nbsp;x &nbsp;2 &nbsp;x &nbsp;2 &nbsp;x &nbsp;2 &nbsp;= &nbsp;16
<!-- new_lines: 1 -->
I/E &nbsp; N/S &nbsp; T/F &nbsp; J/P

<!-- pause -->
<!-- column_layout: [1, 1] -->

<!-- column: 0 -->

    ```typst +render
    #set text(font: "JetBrainsMono NF")
    #scale(100%, reflow: false)[
    #table(
      columns: 3,
      stroke: none,
      align: horizon,
      inset: (
        x: 20pt,
        y: 10pt
      ),
      image("Intj.png", width:70pt), [INTJ], [Architect],
      image("Intp.png", width:50pt), [INTP], [Logician],
      image("infj.png", width:50pt), [INFJ], [Advocate],
      image("infp.png", width:50pt), [INFP], [Mediator],
      image("istp.png", width:50pt), [ISTP], [Virtuoso],
      image("istj.png", width:50pt), [ISTJ], [Logistician],
      image("isfp.png", width:50pt), [ISFP], [Adventurer],
      image("isfj.png", width:50pt), [ISFJ], [Defender],
      )
    ]
```typst +render
#set text(font: "JetBrainsMono NF")
#scale(100%, reflow: false)[
#table(
  columns: 3,
  stroke: none,
  align: horizon,
  inset: (
    x: 20pt,
    y: 10pt
  ),
  image("entj.png", width:60pt), [ENTJ], [Commander],
  image("entp.png", width:60pt), [ENTP], [Debater],
  image("enfj.png", width:60pt), [ENFJ], [Protagonist],
  image("enfp.png", width:60pt), [ENFP], [Campaigner],
  image("estp.png", width:60pt), [ESTP], [Entrepreneur],
  image("estj.png", width:60pt), [ESTJ], [Executive],
  image("esfp.png", width:60pt), [ESFP], [Entertainer],
  image("esfj.png", width:60pt), [ESFJ], [Consul],
)]
```

Back to 0

chardskarth commented 5 months ago

and this is what it looks like:

image

mfontanini commented 5 months ago

I just created #235 which addresses this. Can you try out the branch and see if it works for you? Do read the description in the PR. TL;DR; in your example you need to change your paths to be absolute like


...
image("/entj.png", width:60pt), [ENTJ], [Commander],
image("/entp.png", width:60pt), [ENTP], [Debater],
...
``
chardskarth commented 5 months ago

Your PR works for me!

chardskarth commented 5 months ago

Closing in favor of #235.