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

Export to Netscape Bookmark format #8247

Open
morgandavidson opened this issue Aug 24, 2022 · 3 comments
Open

Export to Netscape Bookmark format #8247

morgandavidson opened this issue Aug 24, 2022 · 3 comments

Comments

@morgandavidson
Copy link

Netscape Bookmark format is used by main browsers (Chrome, MS browsers, Firefox) to export and import browsers bookmarks to HTML.

I find it much easier to manage and centralize browser bookmarks with Org-Mode.

Here is an example of an org file storing some bookmarks (note that in browser bookmarks each heading would correspond to a folder and each link to a bookmark):

* Data
** Finance
*** Crypto
- [[https://no.tradingeconomics.com/xmreur:cur][XMREUR]]
* Webapps
** Code
*** Bash
- [[https://www.shellcheck.net/][ShellCheck]]
  finds bugs in your shell scripts.
*** JSON
- [[https://stedolan.github.io/jq/manual/][jq Manual]]
  jq is a lightweight and flexible command-line JSON processor.
- [[https://jqplay.org/][jq online GUI]]
- [[https://www.json.org/json-en.html][JSON Intro]]

** Diagrams
- [[https://asciiflow.com/#/][asciiflow]]
- [[https://app.diagrams.net/][draw.io]]

** E-mail
- [[https://temp-mail.org][temp email]] 

Unfortunately, I didn't find any tool allowing exporting bookmarks from a markup format to Netscape Bookmark format.

I thought that this feature might be in the scope of Pandoc.

@jgm
Copy link
Owner

jgm commented Aug 24, 2022

This seems a bit too specialized to me. The perfect use case for a custom Lua writer.
https://pandoc.org/custom-writers.html

@morgandavidson
Copy link
Author

At first, I thought of an Elisp tweak for emacs. Indeed a Lua script might be well adapted for the use case.

@morgandavidson
Copy link
Author

morgandavidson commented Sep 6, 2022

Here is how Org-Mode managed bookmarks could be exported to Netscape Bookmarks :

  • Have the following block at the beginning of the exported HTML
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!--This is an automatically generated file.
    It will be read and overwritten.
    Do Not Edit! -->
<Title>Bookmarks</Title>
<H1>Bookmarks</H1>
  • The rest of the exported HTML should be as follow, where {item} may be either a folder or a bookmark:
<DL>
 {item}
 {item}
 {item}
 .
 .
 .
</DL>
  • If {item} refers to a folder, it is:
<DT><H3 FOLDED ADD_DATE="{date}">{title}</H3>
<DL><p>
 {item}
 {item}
 {item}
 .
 .
 .
</DL><p>  

Where {date} is a decimal integer that represents the number of seconds elapsed since midnight January 1, 1970, e.g. 1661350152. And {title} is the name of the folder corresponding to an orgdown headline.

  • If {item} refers to a bookmark, it is:
<DT><A HREF="{Bookmark URL}" ADD_DATE="{date}" LAST_MODIFIED="1661350203">{Bookmark Name}</A>  

Corresponding to Orgdown [[{Bookmark URL}][{Bookmark Name}]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants