Skip to content

Roam Import: Attributes not working #1314

Open

Description

@lezuber

Describe the bug
A clear and concise description of what the bug is.
Attributes in my Roam export are imported as plain text with two ::

Expected behavior
I would expect them to be imported as normal refs.

Activity

  1. lezuber commented on Feb 17, 2021

    @lezuber
    Author

    I've set up a temp workaround for this now. Explanation for semi-technical folks:

    It uses so called regular expressions (regex). Good text editors e.g. SublimeText support a regex out of the box:

    Download the roam JSON export. And run the following regex on the file:
    Search: "string":"([^"]+)::
    Replace with: "string":"[[$1]]
    Now, import the JSON to logseq.

    Alternative
    Personally, I kept the :: at the end of these attribute-references, to style these a bit different in logseq:
    Search: "string":"([^"]+)::
    Replace with: "string":"[[$1::]]

    Now, these "special" tag links can be styled differently by using the following CSS snippet:

    /* Style of my Roam Attributes */
    span.page-reference a[data-ref*="::"] {
        background: #ffb86c;
        color: #282a36;
    }
    
  2. tiensonqin commented on Feb 19, 2021

    @tiensonqin
    Contributor

    Thank you for the temp workaround!
    I've thought of that converting the roam attributes to logseq's properties (for both pages and blocks), this way, the properties can be structural data for queries.
    But roam's attributes can be mixed in the block content, and we don't have clear rules to extract the attribute's value.
    Any ideas?

  3. arminta7 commented on Feb 19, 2021

    @arminta7

    What do you mean by "mixed in the block content"? Aren't Roam's attributes each on one line? Whatever comes before the :: is the name and whatever comes after is the value? Sorry if I'm misunderstanding. It would be great to be able to convert roam's attributes to logseq's properties.

  4. lezuber commented on Feb 26, 2021

    @lezuber
    Author

    I think not even that assumption can be made. At least not for every user. Fundamentally, as they are identical to normal page-refs, I would argue converting them to page-refs is the only way which works for every use-case.
    I agree that many users including me used them as something that would make sense to be converted into properties. But I think this maybe should not be default.

  5. sai-prasanna commented on Aug 8, 2021

    @sai-prasanna

    @lezuber For a 100% valid transformation, what you say makes complete sense. An option that would work for most cases would also be convenient. Most people would have single line attributes without nested content. But for non destructive import, an option for flattening the attribute contents into single line in logseq might make sense.

    Or if logseq supports querying parent nodes given some property of child nodes, I guess leaving it as page ref would by itself be functional.

  6. swordthrower commented on Nov 20, 2021

    @swordthrower

    I'm curious what you would suggest for Roam attributes of the following form:
    Tags:: #Logseq #Video #PKM #[[Smart Notes]]
    (basically, an attribute with several tags/references)

    If the Roam JSON file was updated to turn it into a comma-separated list, would it play nice with Logseq properties when imported into Logseq?

  7. abehr commented on Nov 20, 2021

    @abehr

    @swordthrower that's my most common use case for Roam attributes as well (i.e. including a block at the top of a page with multiple tags, or other attribute titles), which would directly translate to page tags / properties in Logseq if they were parsed in with commas. I agree as @tiensonqin said that it's a bit tricky to know what logic to apply in some of the more ambiguous situations, but I feel like this would cover a lot of use cases.

  8. swordthrower commented on Nov 22, 2021

    @swordthrower

    Thanks, @abehr . I will play around with modifying the JSON Roam export before importing to Logseq.

  9. vasusen commented on Jan 23, 2022

    @vasusen

    @lezuber are you still able to do the following to style the attributes? Due to colon (:) being a special character, I am not able to use it at all even after trying to escape it with either ":" or "\003A"

    /* Style of my Roam Attributes /
    span.page-reference a[data-ref
    ="::"] {
    background: #ffb86c;
    color: #282a36;
    }

  10. moved this to 🗄 Backlog in :Logseq/Issue-Trackeron Jan 1, 2023
  11. added
    :type/enhancement
    on May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    :type/enhancementimport

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions