Open jonathanvoelkle opened 3 years ago
Some css to get you started
.bible {
white-space: initial;
}
.bible h2.extra_text {
font-size: initial;
}
.bible .verse-num {
font-size: x-small;
vertical-align: super;
line-height: 0;
font-weight: initial;
}
I there a way I can get it to format with font sizes that match my Roam? The verse headings are very intrusive...
The comment above contains some css (which decreases the font-size of the heading). You can create a page called roam/css
and place the code above in a css
code block. This will change the styling.
You can also set the font-size of the heading manually like
.bible h2.extra_text {
font-size: 12px;
}
Everything that is added is contained in a span with the class bible
.
Here is a tutorial on how to use custom css: https://nesslabs.com/roam-research-themes-custom-styling-css
If you need more help, you can also contact me on twitter
Well done! Thanks for your work on this.
āļø Copy of your #42SmartBlock from Roam
š Describe the SmartBlock
Loads bible verses directly into roam, using the esv translation (https://api.esv.org, thanks @MehsEzeerf)
ā Describe any prerequisites or dependencies that are required for this SmartBlock
This first of all requires an API key from https://api.esv.org.
1235************************************
window.esv_token = "1235****"
const esv_storage_prefix = "bible" const esv_base_url = 'https://api.esv.org/v3/passage/html/?q='
async function esv_get_bible_verse_async(query) { let local_query = localStorage.getItem(
${esv_storage_prefix}_${query}
) if(local_query) { const local_json = JSON.parse(local_query) console.log("local", local_json) return local_json } else { let heads = new Headers(); heads.append("Authorization",Token ${window.esv_token}
);} }
window.esv_get_bible_verse_async = esv_get_bible_verse_async
const esv_embed_class = 'bible-embed-esv'
async function esv_transform_bible_block(block) { if (!window.esv_token) { block.innerHTML = "no esv.org token" return }
const query = block.innerText; console.log(query)
// remove trigger class such that it is not queried again block.classList.toggle(esv_embed_class);
const bible_resp = await esv_get_bible_verse_async(query)
console.log(bible_resp)
if(bible_resp) { block.innerHTML = bible_resp.passages.join("...") block.classList.toggle("bible-esv"); } else { block.classList.toggle("bible-error"); } console.log("hello", bible_resp) }
function esv_transform_bible(){ let bible_embed = document.getElementsByClassName(esv_embed_class); for(let block of bible_embed) { console.log("block", block) esv_transform_bible_block(block) } }
// setup setTimeout(esv_transform_bible, 200); const esv_checker = setInterval(esv_transform_bible, 1000);
setTimeout(function() { // clearInterval(esv_checker); }, 12000)