Coder Social home page Coder Social logo

cimsta / obsidiosaurus Goto Github PK

View Code? Open in Web Editor NEW
135.0 5.0 11.0 176 KB

Obsidian -> Docusaurus Converter

Home Page: https://cimsta.github.io/obsidiosaurus-docs/

License: MIT License

JavaScript 3.38% TypeScript 96.29% CSS 0.33%
converter docusaurus obsidian-md

obsidiosaurus's People

Contributors

gerzonc avatar mat4m0 avatar nbarlow23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

obsidiosaurus's Issues

Versioning support

Description

Add docs versioning support

Proposal

Reference

https://docusaurus.io/docs/versioning

website
├── sidebars.json        # sidebar for the current docs version
├── docs                 # docs directory for the current docs version
│   ├── foo
│   │   └── bar.md       # https://mysite.com/docs/next/foo/bar
│   └── hello.md         # https://mysite.com/docs/next/hello
├── versions.json        # file to indicate what versions are available
├── versioned_docs
│   ├── version-1.1.0
│   │   ├── foo
│   │   │   └── bar.md   # https://mysite.com/docs/foo/bar
│   │   └── hello.md
│   └── version-1.0.0
│       ├── foo
│       │   └── bar.md   # https://mysite.com/docs/1.0.0/foo/bar
│       └── hello.md
├── versioned_sidebars
│   ├── version-1.1.0-sidebars.json
│   └── version-1.0.0-sidebars.json
├── docusaurus.config.js
└── package.json

Blog support

Description:

Currently its not possible to create Blog posts in Obsidian for Docusaurus.

Proposal:

Based on the first folder, check if name is "blog" or is ending "-blog" (for multiple blog support) -> start conversion and copy files to new location

Obsidian File - Frontmatter:

---
title: Welcome Docusaurus v2
description: This is my first post on Docusaurus 2.
slug: welcome-docusaurus-v2
authors:  
name: Joel Marcey    
title: Co-creator of Docusaurus 1    
url: https://github.com/JoelMarcey    
image_url: https://github.com/JoelMarcey.png  
image: https://i.imgur.com/mErPwqL.png
hide_table_of_contents: false
---

best to create a template for this

Additional Information:

https://docusaurus.io/docs/blog
https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog#markdown-front-matter

Authors:
https://docusaurus.io/docs/blog#blog-post-authors

Idea: Allow for versioning within docusaurus

What I'm trying to achieve is one docusaurus instance serving two distinct docs (multi-instance), where each docs instance is versioned.
Currently I'm using Obsidian to write any docs (also using i18n) and Obsidiosaurus to push it to Docusaurus to fill up the current/next docs. Setting a version happens within Docusaurus and this is totally fine with me.
But when using versioning, two major downsides arise in the areas of Obsidiosaurus:

  1. In order to version assets, they need to be placed within the docs folder. Ideally near the .md-file itself. Currently the path is always set to "/assets/" even though I don't specify an asset folder in my vault structure and the settings in obsidian are set to "new link format: relative path" and "default location for new attachments: same folder as current file".
  2. Currently, with the approach depicted in 1) assets, especially image files, are corrupted. In the resulting .md-file in docusaurus they appear as .webp. Even when I set the path right and set the correct format (like .png instead of .webp) the file won't load since it is corrupted, even though it gets exported into the correct location.

The idea:

  • Enable assets from within the docs folder structure (and if you like still push them through imagemagick)

This allows to write markdown files (that may or may not include assets) in obsidian and export them using obsidiosaurus into docusaurus as the current/next version. You can then version your docs using docusaurus but keep obsidian as a nice markdown editor.

Bug: ENOENT when trying to load file that has been removed

When adding a file in the markdown that is saved in the /assets folder and the file is later on being removed (from the /assets folder as well as the reference within the markdown file), Obsidiosaurus runs into the following error:

Error: ENOENT: no such file or directory, copyfile '/Users/jp-performance/Desktop/wiki/vault/assets/example.svg' -> '/Users/jp-performance/Desktop/wiki/website/static/assets/example.svg'.

The markdown files itself are converted correctly.
After manually deleting the respective asset in the assetInfo.json, the conversion process finishes without throwing an error.

Exacalidraw Images Issues

Currently there are a few issues regarding Exacalidraw Images

Cant have number in name e.g. "2_abc.excalidraw" also dot: "ab.cd.excalidraw"
"abc.excalidraw.md" is okay

Also, the deletion process after renaming or updating drawing is not working correctly.

Strange Behavior with Image Conversion

I have an image in my Obsidian notes that I display with the following line:

![](/assets/24D1-4L01-M1.png)

My compilation step fails with the error:

Cause: Image static/assets/D1-A04-M1.webp used in docs/main/vivoChips/Chips.md not found.
Details:
Error: Image static/assets/D1-A04-M1.webp used in docs/main/vivoChips/Chips.md not found.
    at async Promise.all (index 0)

For whatever reason, during the compilation step, the first two numbers are getting chopped off of my image name. In /website/docs/main/api.md the image is embedded as:

![24D1-A04-M1](//assets/D1-A04-M1.webp)

Is this expected behavior? Can images not begin with numbers?

Excalidraw images duplicated: light and dark versions are both present

When I embed an Excalidraw image to my documentation, both the dark and light versions of that image are imported to my Docusaurus website.

Here's a sample showing a page with a single embedded in Obsidian. When published to Docusaurus, two versions are included in the page at the same time.

Obsidian screen:

CleanShot 2024-06-18 at 10 26 28

Docusaurus website in light mode:

CleanShot 2024-06-18 at 10 25 17

Docusaurus website in dark mode:

CleanShot 2024-06-18 at 10 25 21

Firefox developer tools shows the image is in the DOM twice:

CleanShot 2024-06-18 at 10 29 25

Has anyone else seen this?

Sidebar Improvements

Description

Automate the workflow for sidebar creation based on the first folders in Obsidian "docs" Directory.

Changes to sidebar.js:

const sidebars = {
  A: [{type: 'autogenerated', dirName: 'A'}],
  X: [{type: 'autogenerated', dirName: 'X'}],
 ...

docusaurus.config.js:

const config = { 
  themeConfig:
   /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
   ({
    navbar: {
items: [
         {
           type: 'doc',
           docId: 'A/a',
           position: 'left',
           label: 'a',
         },
         {
           type: 'doc',
           docId: 'X/x',
           position: 'left',
           label: 'x',
         },
                   {to: '/blog', label: 'Blog', position: 'left'},
         {
           type: 'localeDropdown',
           position: 'right',
         },
                 ],
     },
module.exports = config;          

Idea: Allow for i18n in multi-instance setups

Given the following structure where project1 is a single docs instance as well as project2:

- docs
    - project1
        - dev-docs
        - user-docs
    - project2
        - dev-docs
	    - hello-world.md
	- user-docs

the currently generated i18n path looks the following way: i18n/en/docusaurus-plugin-content-docs/project2/current/dev-docs

The path needed for successfully using i18n in an multi-instance setup is: i18n/en/docusaurus-plugin-content-docs-project2/current/dev-docs

It would be great if one could specify in the settings the path to the individual docs instance and their respective id. This way you should be able to generate the correct i18n path.

Idea: Renaming files in obsidian leads to orphans in docusaurus

When renaming .md-files in obsidian and pushing them using obsidiosaurus, I get orphaned .md-files in docusaurus.
Example after first push and before renaming and pushing again:
Obsidian structure:

- docs
    - hello-world.md

Docusaurus structure:

- docs
    - hello-world.md

Example after renaming and pushing:
Obsidian structure:

- docs
    - hello-world-renamed.md

Docusaurus structure:

- docs
    - hello-world.md
    - hello-world-renamed.md

It would be great if orphaned files in docusaurus were prevented.

Bug: Can't find the image assert, because image filename is replaced

When I process the assets in markdown, the assets in the markdown line are replaced. For example:

assets/356a3f33b6ce01782efc24e6a2471f69_MD5.jpeg

is replaced with:

assets/a3f33b6ce01782efc24e6a2471f69_MD5.webp

I scanned the code, and the replacement happens here:

if (!isBlog) {
urlParts = urlParts.map(part => removeNumberPrefix(part));
}

Should I skip this function? I'm not sure of the impact of those lines of code.

i18n Support with grouping folder

Description:

Currently, it is possible to create the translated files directly in Obsidian with a separate endings e.g.: X/File1__en.md, X/File1__de.md
This gets a bit messy when you have many files and languages.

A better approach would be to a have the option for File Folders. They don't get published in the sidebar, their only intent is to group the files together.
In Obsidian it would look like this: X/File1/File1__en.md, X/File1/File1__de.md, ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.