Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion _pages/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The [Neurodata Extensions Catalog (NDX Catalog)](https://github.com/nwb-extensio
<script src="{{ site.url }}/js/lunr.min.js"></script>
<script src="{{ site.url }}/js/jquery-3.5.0.min.js" ></script>
<script src="{{ site.url }}/js/js-yaml.min.js" ></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>

<script>
(function() {
Expand Down Expand Up @@ -62,7 +63,8 @@ $.getJSON("https://api.github.com/orgs/{{ site.github_username }}/repos").done(f
$.getJSON(readmeUrl).done(function(res, status) {
if (status == "success") {
readmeText = atob(res.content)
window.data[recordJson.name].readme = readmeText
var readmeHtml = marked.parse(readmeText)
window.data[recordJson.name].readme = readmeHtml

countLoaded += 1
if (countLoaded == countTotal) {
Expand Down
7 changes: 7 additions & 0 deletions css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,10 @@ table {
.record .ndx-stats {
margin-right: 25px;
}

.readme-preview {
height: 300px; /* Adjust this value to your desired height */
overflow-y: hidden; /* change to scroll to enable scrolling */
position: relative;
padding-right: 20px;
}
34 changes: 17 additions & 17 deletions js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,24 @@ excluded_in_search: true
}

function buildResultHtml(item) {
readmePreview = getPreview(query, item.readme, 300);
if (item.maintainers) {
maintainers = getPreview(query, item.maintainers.join(', '), 100);
} else {
maintainers = '';
readmeHtml = item.readme;
if (item.maintainers) {
maintainers = getPreview(query, item.maintainers.join(', '), 100);
} else {
maintainers = '';
}
resultHtml = "<li class='record'>" +
"<h4><span class='ndx-name'><a href='" + item.src + "'>" + item.name + "</a></span></h4>" +
"<p>" +
"<span class='ndx-stats'>Version: " + item.version + "</span>" +
"<span class='ndx-stats'><a href=\"" + item.pip + "\">PyPI project page</a></span>" +
"<span class='ndx-stats'><a href=\"" + item.record_url + "\">Record repo</a></span>" +
"<span class='ndx-stats'>License: " + item.license + "</span>" +
"</p>" +
"<p>Maintainers: " + maintainers + "</p>" +
"<div class='readme-preview'><p>" + readmeHtml + "</p></div></li>";
return resultHtml;
}
resultHtml = "<li class='record'>" +
"<h4><span class='ndx-name'><a href='" + item.src + "'>" + item.name + "</a></span></h4>" +
"<p>" +
"<span class='ndx-stats'>Version: " + item.version + "</span>" +
"<span class='ndx-stats'><a href=\"" + item.pip + "\">PyPI project page</a></span>" +
"<span class='ndx-stats'><a href=\"" + item.record_url + "\">Record repo</a></span>" +
"<span class='ndx-stats'>License: " + item.license + "</span>" +
"</p>" +
"<p>Maintainers: " + maintainers + "</p>" +
"<p>" + readmePreview + "</p></li>";
return resultHtml;
}

function displaySearchResults(results, query) {
var searchResultsEl = document.getElementById("search-results");
Expand Down