Commit bc8f3a3e authored by Federico Falconieri's avatar Federico Falconieri
Browse files

Merge branch 'md-pres' into 'main'

feat: markdown to presentation

See merge request just-ci/templates!68
parents edf51a22 f6a21363
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
---
include:
  - local: project-automation/badge.yml
  - local: project-automation/check-GL-token.yml

.badge:md-presentation:
  extends: .badge
  variables:
    COLOR: "#6495ED" # Cornflower blue
  before_script:
    - LABEL=$(date +'%Y-%m-%d')
  needs:
    - docs:md-presentation

badge:pdf:
  extends: .badge:md-presentation
  variables:
    VALUE: pdf - ${CI_COMMIT_REF_NAME}
    URL: "${PDF}"
    BADGE_NAME: pdf

badge:pptx:
  extends: .badge:md-presentation
  variables:
    VALUE: pptx - ${CI_COMMIT_REF_NAME}
    URL: "${PPTX}"
    BADGE_NAME: pptx

badge:html:
  extends: .badge:md-presentation
  variables:
    VALUE: html - ${CI_COMMIT_REF_NAME}
    URL: "${HTML}"
    BADGE_NAME: html

badge:images:
  extends: .badge:md-presentation
  variables:
    VALUE: images - ${CI_COMMIT_REF_NAME}
    URL: "${IMAGES}"
    BADGE_NAME: images
+55 −0
Original line number Diff line number Diff line
---
# Running a local webserver of MARP is as easy as:
# docker run --rm -ti -p 127.0.0.1:8080:8080 -v "${PWD}:/pwd" -w /pwd docker.io/marpteam/marp-cli:latest -s .

docs:md-presentation:
  image:
    name: docker.io/marpteam/marp-cli:latest
    entrypoint: [""]
  stage: build
  variables:
    CONVERSION_PATH: "."
    DEFAULT_ARGS: --allow-local-files
    EXTRA_ARGS: ""
  script:
    - apk add zip
    - export PATH=${PATH}:/home/marp/.cli
    - mkdir -p ${CI_PROJECT_DIR}/output

    # First the HTML export
    - marp-cli.js -I ${CONVERSION_PATH} ${DEFAULT_ARGS} ${EXTRA_ARGS} 2>&1 | tee /tmp/output.log
    - OUTPUT_FILES=$(cat /tmp/output.log | grep "=>" | cut -d">" -f2 | cut -d" " -f2)
    - zip -r ${CI_PROJECT_DIR}/output/html.zip *.* -x *.md -x ${CI_PROJECT_DIR}/output
    - rm ${OUTPUT_FILES}
    - echo "HTML=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/output/html.zip" > ${CI_PROJECT_DIR}/links.env

    # Next the images export
    - marp-cli.js --images -I ${CONVERSION_PATH} ${DEFAULT_ARGS} ${EXTRA_ARGS} 2>&1 | tee /tmp/output.log
    - OUTPUT_FILES=$(cat /tmp/output.log | grep "=>" | cut -d">" -f2 | cut -d" " -f2)
    - zip -r ${CI_PROJECT_DIR}/output/images.zip *.png -x *.md -x ${CI_PROJECT_DIR}/output
    - rm ${OUTPUT_FILES}
    - echo "IMAGES=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/output/images.zip" >> ${CI_PROJECT_DIR}/links.env

    # Finally the PDF and PPTX
    - |
      for FORMAT_ARG in --pdf-notes --pptx; do
        marp-cli.js ${FORMAT_ARG} -I ${CONVERSION_PATH} ${DEFAULT_ARGS} ${EXTRA_ARGS} 2>&1 | tee /tmp/output.log
        OUTPUT_FILES=$(cat /tmp/output.log | grep "=>" | cut -d">" -f2 | cut -d" " -f2)
        mv ${OUTPUT_FILES} ${CI_PROJECT_DIR}/output/
      done

    - |
      for FILE in ${CI_PROJECT_DIR}/output/*; do
        BASENAME=$(basename ${FILE})
        echo -e "[+] Get \033[1m${BASENAME}\033[0m from ${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/output/${BASENAME}"
        EXT=$(echo "${BASENAME##*.}" | tr a-z A-Z)
        if [ "${EXT}" != "ZIP" ]; then
          echo "${EXT}=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/output/${BASENAME}" >> ${CI_PROJECT_DIR}/links.env
        fi
      done
  artifacts:
    when: always
    paths:
      - output
    reports:
      dotenv: links.env
+1 −0
Original line number Diff line number Diff line
---
include:
  - local: docs/drawio.yml
  - local: docs/md-presentation.yml
  - local: pipelines/workflow.yml

before_script:
+630 KiB
Loading image diff...
+26 −0
Original line number Diff line number Diff line
---
marp: true
theme: uncover
---

# Hello, I'm Marp CLI!

Write and convert your presentation deck with just a plain Markdown!

---

<!-- backgroundColor: beige -->

## Watch and preview

Marp CLI is supported watch mode and preview window.

---

## We've got images

![hello](gif.gif)

---

# <!--fit--> :+1: