Linked Mentions display multiple lines as one

Hi all,
I’ll keep it short. Here are some screenshots describing the behavior.

Linked Mentions are rendered:

The page is actually:

Is this intended behavior? I do notice this in some places on the main site (For example)

Version: SilverBullet 2.1.6-0-g9521c760

Thanks! Loving SB. Currently migrating from Logseq MD :slight_smile:

1 Like

Sorry to barge in with my off topic question, but sadly I don’t know the answer to your question regarding the Linked Mentions, I don’t really use that feature.

I noticed the weather part on your screenshot and I was wondering is that a widget which is fetching current weather conditions dynamically on your page, or is it a snapshot of the weather on page creation? what are you using to get the weather data on the page?

I too made a shell script which fetches the weather from OpebWeathermap API and displays it dynamically on my Welcome Dashboard page, but I’m currently looking for other alternatives:

I have it do both – a slash command to just get a snapshot and just calling the function will do it dynamically (with hourly updates). I pulled some of this from another thread here on the forum.

local ONE_HOUR = 60 * 60 * 1000

function getWeather(location)
  local timestamp = os.time() * 1000
  local weather = datastore.get({"weather", location})
  
  if not weather or not weather.timestamp or weather.timestamp < (timestamp - ONE_HOUR) then
    local wttrUrl = string.format("https://wttr.in/%s?format=%%t+%%C", location)
    local response = http.request(wttrUrl)
    if response.ok then
      local condition = response.body
      weather = {
        condition = condition,
        timestamp = timestamp,
      }
      datastore.set({"weather", location}, weather)
    end
    if not response.ok then
      return "HTTP request failed."
    end
  end
    
    if not weather then
      return "⚠️ No weather data available."
    end

  return string.format("%s", weather.condition)
end

slashCommand.define {
  name = "weather",
  run = function()
    editor.insertAtCursor(getWeather("Your Location Here"))
  end
}

When called from a template like my journal, just do: ${"$"}{getWeather("Your Location")}

2 Likes

Thanks a lot, I’ll will look into this tomorrow :wink:

[Edit]

Short update: I managed to integrate it on my Welcome Page, it works great!

Thanks again!

No it’s not, I’ve noticed that there are more issues with this, just created an issue for it: Fix linked mentions multi-line behavior · Issue #1588 · silverbulletmd/silverbullet · GitHub

2 Likes