Skip to content

Commit

Permalink
Use Chrome for bookmarks by default when available.
Browse files Browse the repository at this point in the history
  • Loading branch information
xwmx committed Jan 22, 2024
1 parent e4dcf15 commit 13a04a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nb
Original file line number Diff line number Diff line change
Expand Up @@ -9989,7 +9989,10 @@ _download_from() {

local _target_path="${2:-}"

if ((${NB_BROWSER_DOWNLOAD_ENABLED:-}))
if ((${NB_BROWSER_DOWNLOAD_ENABLED:-1})) && {
[[ "${_url}" =~ .html$ ]] ||
[[ ! "${_url}" =~ .[a-zA-Z0-9]$ ]]
}
then
if _command_exists "google-chrome"
then
Expand Down
3 changes: 3 additions & 0 deletions test/bookmark.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,9 @@ $(cat "${NB_TEST_BASE_PATH}/fixtures/example.com.md")"
@test "'bookmark --save-source' creates new note with HTML content." {
{
"${_NB}" init

# Skip browser download to avoid extra whitespace added to output by Chrome.
export NB_BROWSER_DOWNLOAD_ENABLED=0
}

run "${_NB}" bookmark "${_BOOKMARK_URL}" --save-source
Expand Down

0 comments on commit 13a04a9

Please sign in to comment.