Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include non-markdown files in the html output #465

Closed
mhdrone opened this issue Nov 8, 2022 · 6 comments
Closed

Include non-markdown files in the html output #465

mhdrone opened this issue Nov 8, 2022 · 6 comments
Labels
bug Something isn't working resolved
Milestone

Comments

@mhdrone
Copy link

mhdrone commented Nov 8, 2022

Within my obsidian vault I commonly link to pdf and other file types.

I find when exporting the database the markdown export of the files include the linked pdf files while the html export does not, I've read through the documentation and couldn't find a configuration option that included these extra files. I've made sure to use regular markdown syntax when linking to these files as specified in the documentation.

I've also tried running the exporter in the process all mode but I receive the same behavior.

Did I miss a configuration option or is this an intended behavior?

image
image

Thank you!

@dwrolvink
Copy link
Collaborator

Hi mhdrone, I think you're hitting the bug from #421
Going to publish that in version 3.3.0 in a minute, then I guess it will work.

@mhdrone
Copy link
Author

mhdrone commented Nov 8, 2022

Oh sorry, I didn't see that issue. Sounds good, thanks!

@dwrolvink
Copy link
Collaborator

Alright it is published, try pip install obsidianhtml --upgrade and see if the issue persists.

And no problem, kind of a shame you have to dive into all kinds of documentation for an issue that might have been fixed already!

@mhdrone
Copy link
Author

mhdrone commented Nov 8, 2022

I tried the updated release but I am still having the same problem, the files still aren't being copied over to the html export.

Below I've included my config file just in case I misunderstood the documentation (I've removed the directory paths). I am running this on windows 10 with Python 3.10.6 installed.

On another note I've discovered some strange behavior regarding the LaTeX render. Its not a big issue and I don't want to complain a bunch but if you are interested in it I can submit another ticket with details. Again its not a huge problem, it just acts a bit weird.

##########################################################################
#                               PATHS                                    #
##########################################################################
# The first folder that contains all obsidian files
# Can be absent when toggles/compile_md == False
# Use full path or relative path, but don't use ~/
obsidian_folder_path_str: '[Path to Vault]'

# The note that will be used as the index.html
# should be in obsidian_folder_path_str
# Can be absent when toggles/compile_md == False
# Use full path or relative path, but don't use ~/
obsidian_entrypoint_path_str: '[Path to Vault]\index.md'

# Input and output path of markdown files
# This can be an absolute or a relative path (relative to the working directory when calling obsidianhtml)
# Use full path or relative path, but don't use ~/
md_folder_path_str:  'output/md'

# Markdown entrypoint path
# This has to be md_folder_path_str + '/index.md' when toggles/compile_md == True
# This can be an absolute or a relative path (relative to the working directory when calling obsidianhtml)
# Use full path or relative path, but don't use ~/
md_entrypoint_path_str: 'output/md/index.md'

# Output path of HTML files
# This can be an absolute or a relative path (relative to the working directory when calling obsidianhtml)
# Use full path or relative path, but don't use ~/
html_output_folder_path_str: 'output/html'

# If extended logging is enabled under toggles/extended_logging
# Extra information is written to this folder
log_output_folder_path_str: 'output/log'

##########################################################################
#                              OPERATIONS                                #
##########################################################################
# Exclude subfolders
# These are relative to obsidian_folder_path_str
# To exclude a folder two levels deep, use level1/level2
exclude_subfolders:
  - ".obsidian"
  - ".trash"
  - ".DS_Store"
  - ".git"

# Safety feature: make a copy of the provided vault, and operate on that, so that bugs are less likely to affect the vault data.
# Should be fine to turn off if copying the vault takes too long / disk space is too limited.
# The tempdir is automatically removed on exit of the program.
copy_vault_to_tempdir: True

# Determines the function to use to copy your vault over to the tempdir.
# `default` will try to use rsync if it is installed, and otherwise use `shutil`
# `rsync` will do the same, but give a warning when it falls back to shutil
# `shutil` will just use shutil to copy. Use this when rsync is installed but is giving problems.
copy_vault_to_tempdir_method: default

# Enable to print the files being copied
copy_vault_to_tempdir_follow_copy: false

# ObsidianHtml needs to be able to discern between included notes and included files, because included files
# need to be treated differently. This is a configurable setting because we might've missed certain suffixes
# of files that are includable.
included_file_suffixes: ['jpg', 'jpeg', 'gif', 'png', 'bmp', 'pdf', 'mp4', 'webm', 'wav', 'mp3', 'svg']
video_format_suffixes: ['mp4', 'webm']
audio_format_suffixes: ['wav', 'mp3']

# Used to strip the http url hostpart of a link to get a relative link
# e.g. for value "https://git.com/user/repo/-/wikis/mywiki/" then:
#   "https://git.com/user/repo/-/wikis/mywiki/folder/markdown.md" --> /folder/markdown.md
md_source_host_urls: []

##########################################################################
#                             HTML OUTPUT                                #
##########################################################################

# Will be inputted into the Html template as page title
# Not used anywhere else atm.
site_name: 'Helpful Math Notes'

# Use when deploying to https://mydomain.com/html_prefix/ instead of https://mydomain.com/
# use '/html_prefix' (prepend slash, no slash at the end)
html_url_prefix: ''

# Provide the fullpath to a template file to use instead of standard template.
# Note that this file must contain at least "{content}" somewhere in the page.
html_template_path_str: ''

# Provide an array of custom inclusions (css, javascript, etc) that you would like to be included in the resultant html
html_custom_inclusions: []
html_custom_footer_inclusions: []

navbar_links: []

file_exports: []
#file_exports:
#  - encoding: binary
#    src: Resources/Includes/favicon.ico
#    dst: favicon.ico
#  - src: Resources/Includes/christmas_snowflakes.js
#    dst: obs.html/static/christmas_snowflakes.js

##########################################################################
#                    OPTIONAL BEHAVIOR / FEATURES                        #
##########################################################################
toggles:
  # Opt-in/-out of Obsidian->Md conversion, set to False when using proper markdown as input
  compile_md: True

  # Opt-in/-out of Md->Html conversion, set to False when only wanting to get proper markdown from Obsidian
  compile_html: True

  # gitlab is case insensitive, this setting should be true when converting a wiki from that source
  # might also be useful if you have markdown links in your vault
  # note that this does not impact the output, Hello.md will be written to Hello.html
  force_filename_to_lowercase: False

  # If this is false only the entrypoint and all its links (recursively) are processed
  # if true all the notes will be processed
  process_all: True

  # Can be overwritten ad-hoc by using "obsidianhtml -i config.yml -v" (the -v option)
  verbose_printout: False
  debug_filetree_keys: False

  # Write extra information to log_output_folder_path_str
  extended_logging: False

  # This option should be False for Obsidian->Md, but can be True when compile_md == False
  # Setting it to True will cause an error when two files with the same file name are found anywhere in the input folder
  allow_duplicate_filenames_in_root: True

  # Sometimes linked images that should be local (based on the path) cannot be found.
  # Toggle this to False to disable warnings if that happens.
  warn_on_skipped_image: True

  # This will skip emptying output folders, if you want to implement this yourself
  no_clean: False

  # Whether the markdown interpreter assumes relative path when no / at the beginning of a link
  relative_path_md: True

  # Whether the html paths will be relative.
  # Note: This is only useful if you want to open the html locally on your machine without using a webserver
  #  and is generally not advised. This will also disable all features that need a webserver to function
  #  such as the graph view.
  relative_path_html: False

  # Whether external http anchor links should have a target of "_blank"
  external_blank: False

  # Will preserve inline tags. This will give polluted markdown output
  preserve_inline_tags: True

  features:
    styling:
      layout: documentation               # documentation, tabs, minimal
      max_note_width: 120rem              # not supported for layout: tabs
      add_toc: True                       # add "[TOC]" (Table of Contents) when missing
      toc_pane: True                      # removes table of contents from the note and puts it in the right pane (not supported for layout:tabs)
      flip_panes: False                   # switch right and left pane around. (does nothing unless in documentation layout.)
      add_dir_list: True                  # show directory contents in one of the panes (only documentation layout)
      accent_color: '65, 76, 253'
      loading_bg_color: '255, 255, 255'

    theme_picker:
      enabled: True
      styling:
        show_icon: True

    code_highlight:
      enabled: True
    mermaid_diagrams:
      enabled: True
    callouts:
      enabled: True
    math_latex:
      enabled: True
    backlinks:                  # Show backlinks at the bottom of each note
      enabled: True
    embedded_note_titles:
      enabled: True

    search:
      enabled: True
      styling:
        show_icon: True

    tags_page:
      enabled: True
      styling:
        show_icon: True
        show_in_note_footer: True

    dataview:
      enabled: False
      folder: 'obs.html/export'       # relative to the vault being processed. this folder should always be in the vault

    folder_notes:
      enabled: False
      placement: 'outside folder'     # 'inside folder' , 'outside folder'
      naming: 'folder name'           # 'folder name', 'index', 'aurkibidea', 'etc'

    eraser:
      enabled: True

    breadcrumbs:
      enabled: False

    # Include code to build the graph view per page
    graph:
      enabled: True                   # Include code to build the graph view per page (default: True)
      templates:
        - id: 2d
          name: 2d
          path: builtin<2d>
        - id: 3d
          name: 3d
          path: builtin<3d>
      styling:
        show_icon: True
      coalesce_force: '-30'

    # Create an index.md with links to notes that have one of the given tags.
    # This index.md will serve as the entrypoint.
    # !! Enabling this feature will overwrite obsidian_entrypoint_path_str and md_entrypoint_path_str
    create_index_from_tags:
      enabled: False
      add_links_in_graph_tree: True
      tags: []
      sort:
        method: 'none'          # <key_value, creation_time, modified_time, none>    ! created_time not available on Linux!
        key_path: ''            # empty for top level, use ':' to go down multiple levels
        value_prefix: ''        # in case of multiple values under key_path, match on this prefix, and then remove prefix
        reverse: false          # false/true reverses output
        none_on_bottom: true    # will put notes at the bottom that do not have the sort key, otherwise at the top
      exclude_paths:            # don't included these paths in the dir list
       - ".gitignore"

    rss:
      enabled: False
      host_root: 'https://localhost:8000/'
      styling:
        show_icon: True
      channel:
        title: 'Notes'
        website_link: '<https://your website.com>'
        description: '<your description>'
        language_code: 'en-us'
        managing_editor: 'n/a'
        web_master: 'n/a'
      items:
        selector:
          match_keys: []
          exclude_keys: []
          include_subfolders: []
          exclude_subfolders: ['.git','obs.html']
          exclude_files: ['not_created.html', 'index.html']
        description:
          selectors:
            - ['yaml','rss:description']
            - ['first-paragraphs', 2, '<br/><br/>']
            - ['first-header', 1]
        title:
          selectors:
            - ['yaml','rss:title']
            - ['first-header', 1]
            - ['path', ['parent',1], '/ ', ['stem']]
        publish_date:
          selectors:
            - ['yaml','rss:publish_date']
            - ['yaml_strip','tags',['date/']]
          iso_formatted: True
          format_string: '' #'%Y-%m-%d'

    create_index_from_dir_structure:
      enabled: True
      rel_output_path: 'obs.html/dir_index.html'
      styling:
        show_icon: True
      exclude_subfolders:
        - ".git"
        - "__src"
        - "md"
        - "obs.html"
      exclude_files:
        - "favicon.ico"
        - "not_created.html"

Thanks so much for helping me out with this, I really appreciate it!

dwrolvink added a commit to dwrolvink/obsidian-html that referenced this issue Nov 11, 2022
dwrolvink added a commit that referenced this issue Nov 11, 2022
@dwrolvink
Copy link
Collaborator

dwrolvink commented Nov 11, 2022

First of all, bug reports like this really help me make this package usable for everyone. My personal usecases are very limited, and there are a lot of features requested that were added that I never use. For every person bothering to create a bugreport/issue, I assume there are multiple that are annoyed and/or just decide to work around it or pick some other solution, so this is really a "one hand washing another and both getting clean" situation.

So yeah do make an issue for the Latex issue that you're facing.
Also bit of a late reply because I totally missed that you responded already.

One of the things that I don't use is pdf links, I only use pdf inclusions, so that led me to miss a very obvious bug that was introduced when working on the inclusion requests. It just didn't copy files at all if they are qualified as includable, which is a weird decision from my part, not sure why I added that. I removed it and now everything works as intended.

You can try it out by running:

pip uninstall obsidianhtml
pip install git+https://github.com/obsidian-html/obsidian-html.git

If it doesn't work please share the output of obsidianhtml version just as a sanity check for me.

@dwrolvink
Copy link
Collaborator

closing for lack of feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved
Projects
None yet
Development

No branches or pull requests

2 participants