The fluorine K-shell (1s) excitation spectra of HF and F2 have been studied by small-angle inelastic scattering of 2.5 keV electrons. The F2 spectrum exhibits a dramatic 1s to sigma * shape resonance 14.5 eV below the F 1s ionisation threshold which is qualitatively different from the 1s to sigma * transitions observed in all other first-row diatomics. An empirical correlation between experimental term values for both sigma * and pi * K-shell shape resonances and the sum of the atomic numbers of the heavy atoms in a series of first-row molecules is demonstrated and tested with respect to the energy of the 1s to sigma * transition in F2. The sigma * and pi * energies of a variety of molecules have been predicted using this relationship. In contrast to F2, the HF spectrum is more atom-like, exhibiting a moderately intense 1s to sigma * transition followed by the np Rydberg series. The equivalent-core analogy is applied to the HF and F2 results to predict excitation and ionisation energies of NeH and NeF.