une extension1 par Mokeyish
2023-05-12
title:
est même obligatoire).date: au
format iso (utilisation de bibliothèques javascript pour restituer en
langage naturel)author: "Prénom Nom^[affiliation]"
title: "Titre"
subtitle: "Source^[<url>]"
date: 2023-05-16
lang: fr
# tags: [tag1, tag2]
# url: https://link.org/index.html-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/math_block.lua" --standalone -s -o "${outputPath}" -t html--metadata title="${currentFileName}" pour
utiliser la valeur de title de l’en-tête YAML de mes notes
(ce qui rend ce champs obligatoire).--embed-resources : mettre les
pièces-jointes (pdf, jpg…) en ligne (sur un netlify par
exemple)
--mathjax="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg-full.js" -C --bibliography="${vaultDir}/DATA/bib/MabibliothèqueSync.json" --csl="${vaultDir}/DATA/CSL/transversalites-Braud.csl" --toc --toc-depth=5 -H "${vaultDir}/DATA/pandoc-add.css" -H "${vaultDir}/DATA/pandoc-js.html" -B "${vaultDir}/DATA/pandoc-logo.html" --reference-links --highlight-style=espresso -F mermaid-filter.cmd --lua-filter="${vaultDir}/DATA/obsidian-callouts.lua"--bibliography pointe vers un export synchronisé de
l’intégralité de ma bibliothèque Zotero via Better BibTeX2.--lua-filterslua)Below a quick-and-dirty solution which converts Obsidian callout blocks
[!NOTE]- Note Title
Note content
to Pandoc’s native Divs
::: {.callout data-callout="note" title="Note Title"}
Note content
:::
with the following Pandoc command:
pandoc -t markdown --lua-filter obsidian-callouts.lua file.md
Important: Please note, that in order for this simple filter to work properly, callout type and title line should occupy a separate paragraph.
Here the content of the obsidian-callouts.lua file:
local stringify = (require "pandoc.utils").stringify
function BlockQuote (el)
start = el.content[1]
if (start.t == "Para" and start.content[1].t == "Str" and
start.content[1].text:match("^%[!%w+%][-+]?$")) then
_, _, ctype = start.content[1].text:find("%[!(%w+)%]")
el.content:remove(1)
start.content:remove(1)
div = pandoc.Div(el.content, {class = "callout"})
div.attributes["data-callout"] = ctype:lower()
div.attributes["title"] = stringify(start.content):gsub("^ ", "")
return div
else
return el
end
end
You can modify it to convert callout blocks depending on the output format (HTML, LaTeX, etc.)
.callout {
color:black;
margin: 1em 1.4em 2em 2.4em;
padding: 1em 1em;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
font-family: Arial, Helvetica, sans-serif;
font-size:0.9em;
height: 1.2em;
overflow: hidden;
transition-duration: 0.8s;
}
.callout:hover {
height: fit-content;
transition-duration: 0.6s;
}
.callout::before {
content: "⌵ " attr(title) " ⌵";
font-weight: 600;
}
.callout[data-callout="note"] {
border-left: 4px solid deeppink;
background-color:lavender;
}
.callout[data-callout="note"]::before {
color: deeppink;
}
.callout[data-callout="info"] {
border-left: 4px solid cadetblue;
background-color:ivory;
}
.callout[data-callout="info"]::before {
color: cadetblue;
}
.callout[data-callout="example"] {
border-left: 4px solid peru;
background-color:gainsboro;
}
.callout[data-callout="example"]::before {
color: peru;
}
.callout p {
text-indent: 0em;
text-align: left;
}-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/pdf.lua" --embed-resources --standalone -s -o "${outputPath}" -t pdf--pdf-engine=xelatex -C --bibliography="${vaultDir}/DATA/bib/MabibliothèqueSync.json" --csl="${vaultDir}/DATA/CSL/transversalites-Braud.csl" --toc --toc-depth=5 --reference-links --highlight-style=espresso -F mermaid-filter.cmd --lua-filter obsidian-callouts.lua -V links-as-notes=true-V links-as-notes=true : les liens sont transformés en
notes :)-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" -s -o "${outputPath}" -t docx--toc --toc-depth=5 -C --bibliography="${vaultDir}/DATA/bib/MabibliothèqueSync.json" --csl="${vaultDir}/DATA/CSL/transversalites-Braud.csl" -F mermaid-filter.cmd--highlight-style=STYLE|FILEpandoc --list-highlight-stylesespresso--highlight-style=espresso