diplodoc-platform / diplodoc

Entrypoint to Diplodoc platform
MIT License
179 stars 6 forks source link

Absolute path in assets #16

Open kirillde opened 7 months ago

kirillde commented 7 months ago

I have .md file:

# Описание папок в src и проектов в них

В папке **src** находится исходный код микросервисов, модулей и вспомогательных библиотек ... .

![](../_images/structure.png)

## Extras

Папка, cодержащая вспомогательные библиотеки, используемые для поддержки мультиязычности в библиотеках вьювера.

...... - фронтэнд библиотека для сбора локалей и поддержки мультиязычности в библиотеках вьювера.

## Tangl

Содержит библиотеки вьювера.

### Вьювер

- ......  - библиотека вьювера.

and toc.yaml file

title: ....
href: index.yaml;
navigation:
  logo:
    url: '../tangl'
  header:
    leftItems:
      - text: 'Item..'
        type: 'link'
        #url: '../../how-to/'
      - text: 'Item...'
        type: 'link'
        #url: '../../docs/ru/'
items:
  - name: CHANGELOG
    href: CHANGELOG.md
  - name: Разделы
    expanded: true
    items:
      - name: Структура
        href: structure.md

run this command yfm -i ./docs -o ./output

and i have generated object with assets, which has absolute path for images in assets list

{ "data": { "leading": false, "toc": { "title": "Tangl", "href": "index.html", "navigation": { "logo": { "url": "../tangl" }, "header": { "leftItems": [ { "text": "Item..", "type": "link" }, { "text": "Item...", "type": "link" } ] } }, "items": [ { ..... }, { ..... }, { "name": "Разделы", "expanded": true, "items": [ ...... ], "id": "Разделы-2-0.2943391760813012" } ], "base": "...." }, "meta": { "metadata": [], "style": [], "script": [] }, "assets": [ "/home/..../www/work/test/output/.tmp_input/_images/structure.png" ], "headings": [ { "title": "Extras", "href": "#extras", "level": 2 }, { "title": "....", "href": "#...", "level": 2, "items": [ { "title": "Вьювер", "href": "#vyuver", "level": 3 } ] } ], "title": "Описание папок в src и проектов в них", "includes": [], "html": "...." }, "router": { "pathname": "structure.html" } }

In the result paths point to tmp folder which will be deleted after build process which is an unexpected behavior

But... my html generated correctly <img src="../_images/tangl-structure.png" />

3y3 commented 1 month ago

Looks very buggy. We will try to reproduce this.

bongiozzo commented 2 weeks ago

We will try to reproduce this.

It's reproduced in Debian environment https://t.me/diplodoc_ru/1866

It seems that assets are collected in transform repo https://github.com/diplodoc-platform/transform/blob/master/src/transform/md.ts

bongiozzo commented 2 weeks ago

https://github.com/diplodoc-platform/transform/blob/028f96aa9d21353d5e1d6f20f97744031e15c852/src/transform/plugins/images/index.ts#L32

It seems "path" should be replaced with "src"