Skip to content

Commit

Permalink
add excerpts
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleguido committed Oct 26, 2024
1 parent 0d726e9 commit c2013d0
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 8 deletions.
13 changes: 10 additions & 3 deletions src/components/NotebookViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ const splitTextWithCellInfo = (
}> = []
const regex = /\{\/*\*\s*cell:(\d+)\s*cell_type:(\w+)\s*\*\/\}/g
let match

while ((match = regex.exec(text)) !== null) {
console.log(match)
debugger
cells.push({
idx: match.index,
l: match[0].length,
Expand All @@ -34,6 +35,8 @@ const splitTextWithCellInfo = (
content: "",
})
}
console.log("CELL", cells)
debugger
// now based on the indexes we can extract the content
for (let i = 0; i < cells.length; i++) {
const start = cells[i].idx + cells[i].l
Expand Down Expand Up @@ -123,8 +126,12 @@ const NotebookViewer: React.FC<NotebookViewerProps> = ({
))}
</Col>
<Col lg="5" className="ps-4">
<h4>Abstract</h4>
<MarkdownSnipped className="m-0 small" value={excerpt} />
{excerpt.length > 0 && (
<>
<h4>Abstract</h4>
<MarkdownSnipped className="m-0 small" value={excerpt} />
</>
)}
<div
style={{
position: "sticky",
Expand Down
1 change: 1 addition & 0 deletions src/content/notebooks/impresso-py-collections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ sha: 4a05f4772be7279de1908f46c93dc12de334d112
date: 2024-10-11T07:37:06Z
googleColabUrl: https://colab.research.google.com/github/impresso/impresso-py/blob/main/examples/notebooks/collections.ipynb
links: []
excerpt: The notebook shows how to find collections associated with your Impresso account and retrieve details about specific collections using their IDs. Then it demonstrates how to search, get, add, and remove items from collections using the Impresso Python Library.
---

{/* cell:0 cell_type:code */}
Expand Down
Loading

0 comments on commit c2013d0

Please sign in to comment.