mirror of
https://github.com/lossless-group/perplexed-plugin.git
synced 2026-07-22 06:49:50 +00:00
fix(sources-footer): add *** separator above # Sources h1, blank-line spacing
Reference section now emits as:
{content}
***
# Sources
[1]: [Title](URL)
[2]: [Title](URL)
Blank line before the separator, blank line between separator and the
h1 heading (Sources promoted from h2 to h1), blank line before the first
reference. Matches the user-preferred citation-block shape per the
Lossless citation spec aesthetic.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
562c748234
commit
293a2bd860
1 changed files with 4 additions and 1 deletions
|
|
@ -69,13 +69,16 @@ function buildSourcesFooter(sources: PerplexitySource[]): string {
|
|||
// cite-wide's parser (REFDEF_NUM_RE, line 91 of llmCitationParserService.ts)
|
||||
// accepts both `[N]` and `[N]:` thanks to the `(:?)` group, but the colon
|
||||
// form matches the spec, so emit it.
|
||||
//
|
||||
// Footer shape: blank line before the `***` separator, blank line between
|
||||
// the separator and the `# Sources` h1, blank line before the references.
|
||||
const lines = sources.map((s, i) => {
|
||||
const n = i + 1;
|
||||
const title = (typeof s.title === 'string' && s.title) ? s.title : (s.url ?? 'Source');
|
||||
const url = s.url ?? '';
|
||||
return url ? `[${n.toString()}]: [${title}](${url})` : `[${n.toString()}]: ${title}`;
|
||||
});
|
||||
return '\n\n## Sources\n\n' + lines.join('\n') + '\n';
|
||||
return '\n\n***\n\n# Sources\n\n' + lines.join('\n') + '\n';
|
||||
}
|
||||
|
||||
const FRONTMATTER_FENCE = '---';
|
||||
|
|
|
|||
Loading…
Reference in a new issue