panglesd
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Odoc 3.0 Planning: Assets and medias in odoc This discussion builds on https://github.com/ocaml/odoc/discussions/1097, focusing on assets and media elements. ## Referencing assets Recall from https://github.com/ocaml/odoc/discussions/1097: > A 'unit of documentation' consists of a set of documents and assets in a hierarchical directory structure. Documentation files are mld files, and assets are jpegs, pngs, svgs, etc., that are referenced by the docs. Assets are part of the hierarchy. They are referenced in a similar way to pages. The new `asset` keyword can be used to disambiguate. Here are some examples of reference to assets: `"data.json"`, `asset-"data.json"`, `data/"example.json"`, or `data/asset-"example.json"`. ### Asset path When references are used in places where we know they should link to assets (see [here](#Including-media)), some of the syntax for general references is not needed, but tedious to escape. In particular, dots (`.`) and dashes (`-`) are often seen in filenames but interpreted by odoc, leading to additional `"`, as in `{!directory/"file.img"}`. In order to make it easier to write, we define asset path as normal references where the part after the last `/` is considered verbatim. So an asset path `dirname/file-name.extension` is parsed as the normal reference `dirname/"file-name.extension"`. ### Resolving assets within a page When resolving asset references/paths in a page within the hierarchy, assets can be resolved relatively or absolutely, up to the root of the documentation tree. For example, given the hierarchy (omitting `index.mld` files: all directories must contain an `index.mld`, even if they do not contain a page but only assets!): ``` /data.json /a/result.dat /a/b/baz.mld /a/b/image.jpg /a/b/d/windows.exe /a/c/template.ml ``` when resolving in `baz.mld`, the following are valid paths (assuming our package name is `pkgname`): ``` {!../result.dat} {!../c/template.ml} {!../../data.json} {!d/windows.exe} {!image.jpg} {!/pkgname/data.json} {!/otherpackage/something_in_another_package.txt} ``` For completeness, here are the same path but written as references (instead of asset paths): ``` {!../asset-"result.dat"} or {!../"result.dat"} {!../c/asset-"template.ml"} or {!../c/"template.ml"} {!../../asset-"data.json"} {!d/"windows.exe"} {!dir-d/"windows.exe"} {!"image.jpg"} {!/pkgname/asset-"data.json"} or {!/pkgname/"data.json"} {!/otherpackage/asset-something_in_another_package} ``` ### Resolving assets within a module The same mechanism that adds a package's documentation pages to the scope also adds the corresponding assets. The asset path `/packagename/a/b/c/d.txt` would refer to the asset that usually ends up installed at `<opam dir>/doc/<packagename>/odoc-pages/a/b/c/d.txt` ## Including media The syntax for including media builds on the syntax for reference links. A media is inserted by `{<media><kind><target>}` where: - `<media>` can be either `figure` for figures, `image` for images, `audio` for audio, and `video` for video, or `asset` for asset links - `<sep>` is either `!` if `<target>` is an [asset path](#Asset-path), or `:` if `<target>` is a link. `{asset:<link>}` renders the same as `{:<link>}`. An additional "replacement", "caption" or "alternative" text can be added with the following syntax: `{{<media><kind><target>}<replacement text>}`. The replacement text can only contain inline elements. Here is the meaning of each media: | Media | Rendered as | Type | Text used as | Text can contain | |----------|-------------|----------------|--------------------|-------------------------------------------| | `asset` | link | Inline | Displayed text | Inlines but no links | | `image` | image | Nestable block | alternative | Text | | `video` | video | Nestable block | alternative | Inlines | | `audio` | audio | Nestable block | alternative | Inlines | <!-- | `figure` | figure | Nestable block | media then caption | Image, Audio or Video followed by Inlines | The `figure` media is a little bit more complex than other medias. --> Here are some examples: ``` {image!../figure.jpg} {image!../figure.jpg} {{image!ellen.jpg}Astronaut Ellen Ochoa} {image:https://picsum.photos/200/300} {{image:https://picsum.photos/200/300}Randomly chosen image} {video!dirname/output.mpg} {video!/pkgname/output.mpg} {video:https://example.com/output.mpg} {{video!/pkgname/output.mpg}The output from pkgname is very cool!} {{video:https://example.com/output.mpg}Introductory video} {audio!dirname/output.ogg} {audio!/pkgname/output.ogg} {audio:https://example.com/output.ogg} {{audio!/pkgname/output.ogg}The output from pkgname is very cool!} {{audio:https://example.com/output.ogg}Introductory video} {asset!dirname/output.ogg} {asset!/pkgname/output.ogg} {{asset!/pkgname/output.ogg}The output from pkgname is very cool!} ``` ## Figures Medias can be included in (captioned) figures. This allows to reference them. The syntax is as follows: `{figure<?:id> <media>}` or `{{figure<?:id> <media>}<caption>}` where: - `<?:id>` is either empty or a `:` followed by an `id`. If no `id` is given, one is autogenerated from the caption (if existant). - `<media>` is either an image, audio or video element, - `<caption>` consists of the inline elements that will be rendered as the caption for the figure. Figures are nestable block elements. They can be referenced by id (using the `label` prefix for disambiguation). Examples: ``` {figure {image!kangaroo.svg}} {figure {image!kangaroo.svg} Kangaroo numbers in Victoria from 1880 to 1980} Refer to {!"kangaroo-numbers-in-victoria-from-1880-to-1980"} for more details. {figure:kang {image!kangaroo.svg} Kangaroo numbers in Victoria from 1880 to 1980} Refer to {!kang} for more details. {figure:kang {{image!kangaroo.svg} Line graph showing a doubling of kangaroo numbers from 1880 to 1980} Kangaroo numbers in Victoria from 1880 to 1980} ``` The last example, taken from [here](https://www.stylemanual.gov.au/content-types/images/alt-text-captions-and-titles-images), shows that alternative text and caption are different. Audio and video are also allowed in figures: ``` {figure {{video!flowers.mpg}Video of flower growing in rocky ground} These beautiful flowers (Hoary sunray) decorate the Snowy Mountains in summer} {figure {{audio!birds.mp3}Sounds of birds} The audio landscape in this country is very nice} ``` ## Rendering medias ### HTML Rendering media in html is easy thanks to HTML5 features. The size for rendered images and figures depend on the size of the asset. Audio and video have controls embedded. ### Latex How medias are inserted in latex is made on a best-effort basis. Here are some ideas: - Links to assets could be made using [attachfile2](https://www.ctan.org/pkg/attachfile2). - Image assets could be made using `\includegraphics`. - Images with absolute links could be made using this [trick](https://tex.stackexchange.com/questions/5433/can-i-use-an-image-located-on-the-web-in-a-latex-document) - Figures are made using the figure environment. - Video and audio could be made using the [media9](https://ctan.org/pkg/media9) package. Medias are rendered without size specification: they use the original size of the media. They are block elements. ## Assets for installed packages Assets should be installed in the hierarchy that starts at `<pkgname>/odoc-pages/`. Additionally, any file installed in `<pkgname>/odoc-assets/` will be equivalent to the file installed in `<pkgname>/odoc-pages/_assets/`. This allows compatibility with the [`odig` convention](https://erratique.ch/software/odig/doc/packaging.html#odoc_api_and_manual).

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully